OpenAIResponse
Defined in: frontend/dist/types/adapters/openai.d.ts:150
OpenAI Chat Completions API response structure.
Contains the complete response from OpenAI’s API including the generated message, finish reason, and token usage statistics.
- OpenAIRequest
- OpenAIMessage
- https://platform.openai.com/docs/api-reference/chat/object
Example
Section titled “Example”const response: OpenAIResponse = { id: 'chatcmpl-123', object: 'chat.completion', created: 1677652288, model: 'gpt-4', choices: [{ index: 0, message: { role: 'assistant', content: 'Hello! How can I help you today?' }, finish_reason: 'stop' }], usage: { prompt_tokens: 9, completion_tokens: 12, total_tokens: 21 }};Properties
Section titled “Properties”choices
Section titled “choices”choices:
object[]
Defined in: frontend/dist/types/adapters/openai.d.ts:160
Array of completion choices (usually just one)
finish_reason
Section titled “finish_reason”finish_reason:
"length"|"stop"|"tool_calls"|"content_filter"|null
Reason why generation stopped: ‘stop’ (natural), ‘length’ (max tokens), ‘tool_calls’, ‘content_filter’, or null
index:
number
Choice index in the array
message
Section titled “message”message:
OpenAIMessage
Generated message from the assistant
created
Section titled “created”created:
number
Defined in: frontend/dist/types/adapters/openai.d.ts:156
Unix timestamp when the response was created
id:
string
Defined in: frontend/dist/types/adapters/openai.d.ts:152
Unique identifier for this completion
model:
string
Defined in: frontend/dist/types/adapters/openai.d.ts:158
Model used for generating the response
object
Section titled “object”object:
"chat.completion"
Defined in: frontend/dist/types/adapters/openai.d.ts:154
Object type - always ‘chat.completion’ for non-streaming
usage?
Section titled “usage?”
optionalusage:object
Defined in: frontend/dist/types/adapters/openai.d.ts:169
Token usage statistics for billing and monitoring
completion_tokens
Section titled “completion_tokens”completion_tokens:
number
Number of tokens in the completion
prompt_tokens
Section titled “prompt_tokens”prompt_tokens:
number
Number of tokens in the prompt
total_tokens
Section titled “total_tokens”total_tokens:
number
Total tokens used (prompt + completion)