Skip to content

MistralResponse

Defined in: adapters/mistral.ts:110

Mistral AI API response structure.

OpenAI-compatible response format with Mistral-specific finish reasons. Includes generated message and token usage statistics.

  • MistralRequest
  • MistralMessage
const response: MistralResponse = {
id: 'cmpl-123',
object: 'chat.completion',
created: 1677652288,
model: 'mistral-small',
choices: [{
index: 0,
message: {
role: 'assistant',
content: 'Hello! How can I help?'
},
finish_reason: 'stop'
}],
usage: {
prompt_tokens: 10,
completion_tokens: 6,
total_tokens: 16
}
};

choices: object[]

Defined in: adapters/mistral.ts:124

Array of completion choices (usually one)

finish_reason: "stop" | "length" | "model_length" | null

Stop reason: ‘stop’, ‘length’, ‘model_length’, or null

index: number

Choice index

message: MistralMessage

Generated message


created: number

Defined in: adapters/mistral.ts:118

Unix timestamp of creation


id: string

Defined in: adapters/mistral.ts:112

Unique completion identifier


model: string

Defined in: adapters/mistral.ts:121

Model used for generation


object: "chat.completion"

Defined in: adapters/mistral.ts:115

Object type - always ‘chat.completion’


usage: object

Defined in: adapters/mistral.ts:136

Token usage statistics

completion_tokens: number

Tokens in completion

prompt_tokens: number

Tokens in prompt

total_tokens: number

Total tokens used