ChatChoice - TypeScript SDK

ChatChoice type definition

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Chat completion choice

Example Usage

1import { ChatChoice } from "@openrouter/sdk/models";
2
3let value: ChatChoice = {
4 finishReason: "stop",
5 index: 0,
6 message: {
7 role: "assistant",
8 },
9};

Fields

FieldTypeRequiredDescriptionExample
finishReasonmodels.ChatFinishReasonEnum✔️N/Astop
indexnumber✔️Choice index0
logprobsmodels.ChatTokenLogprobsLog probabilities for the completion{"content": [{"bytes": null,"logprob": -0.612345,"token": " Hello","top_logprobs": []}
],
“refusal”: null<br />}
messagemodels.ChatAssistantMessage✔️Assistant message for requests and responses{"content": "What is the capital of France?","role": "user"}