--- url: "https://developers.openai.com/api/docs/api-reference/completions" titulek: "Completions | OpenAI API Reference" h1: "Completions" popis: "" jazyk: "en" kanonicka: "https://developers.openai.com/api/reference/resources/completions/" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 09:52:50" znaku: 4285 slov: 510 kodovani: "utf-8" sha256: "827c1ac6b52fe52ecb1cc924f207859a80da6631762c33f4ec62b9b0b28002f2" --- ##### ModelsExpand Collapse Completion object { id, choices, created, 4 more } Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).id: stringA unique identifier for the completion.choices: array of [CompletionChoice](/api/reference/resources/completions#(resource)%20completions%20%3E%20(model)%20completion_choice%20%3E%20(schema)) { finish_reason, index, logprobs, text } The list of completion choices the model generated for the input prompt.finish_reason: "stop" or "length" or "content_filter"The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, or `content_filter` if content was omitted due to a flag from our content filters.One of the following:"stop""length""content_filter"index: numberlogprobs: object { text_offset, token_logprobs, tokens, top_logprobs } or nulltext_offset: optional array of numbertoken_logprobs: optional array of numbertokens: optional array of stringtop_logprobs: optional array of map[number]text: stringcreated: numberThe Unix timestamp (in seconds) of when the completion was created.formatunixtimemodel: stringThe model used for completion.object: "text_completion"The object type, which is always “text_completion”system_fingerprint: optional stringThis fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.usage: optional [CompletionUsage](/api/reference/resources/completions#(resource)%20completions%20%3E%20(model)%20completion_usage%20%3E%20(schema)) { completion_tokens, prompt_tokens, total_tokens, 2 more } Usage statistics for the completion request. CompletionChoice object { finish_reason, index, logprobs, text } finish_reason: "stop" or "length" or "content_filter"The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, or `content_filter` if content was omitted due to a flag from our content filters.One of the following:"stop""length""content_filter"index: numberlogprobs: object { text_offset, token_logprobs, tokens, top_logprobs } or nulltext_offset: optional array of numbertoken_logprobs: optional array of numbertokens: optional array of stringtop_logprobs: optional array of map[number]text: string CompletionUsage object { completion_tokens, prompt_tokens, total_tokens, 2 more } Usage statistics for the completion request.completion_tokens: numberNumber of tokens in the generated completion.prompt_tokens: numberNumber of tokens in the prompt.total_tokens: numberTotal number of tokens used in the request (prompt + completion).completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, 2 more } Breakdown of tokens used in a completion.accepted_prediction_tokens: optional numberWhen using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.audio_tokens: optional numberAudio input tokens generated by the model.reasoning_tokens: optional numberTokens generated by the model for reasoning.rejected_prediction_tokens: optional numberWhen using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.text_tokens: optional numberText output tokens generated by the model.prompt_tokens_details: optional object { audio_tokens, cache_write_tokens, cached_tokens, 2 more } Breakdown of tokens used in the prompt.audio_tokens: optional numberAudio input tokens present in the prompt.cache_write_tokens: optional numberThe unadjusted number of prompt tokens written to cache.cached_tokens: optional numberCached tokens present in the prompt.image_tokens: optional numberImage input tokens present in the prompt.text_tokens: optional numberText input tokens present in the prompt.