Skip to main content
Call the SDK’s chat method to send POST /v1/chat/completions and get one completed response. For new integrations, the Responses API gives one request shape for text, multimodal input, tools and richer output items.
Every return value has the Chat Completions shape: the reply is in choices[0].message.content, with finish_reason and usage alongside.

Stream the response

Each parsed chunk (TypeScript and Python) keeps the original fields (choices, id, …) and adds text (the content added by this chunk), usage and reasoning tokens (reasoningTokens / reasoning_tokens).

Parameters

Field names are the JSON body fields in every SDK. Go’s typed phaseo.ChatCompletionsRequest uses PascalCase struct fields (Model, Messages). Parameters explains each field, and the Chat Completions API reference has the full schema.

Response

ChatCompletionsResponse:
With stream: true, the endpoint sends SSE frames that end with data: [DONE]:
Last modified on November 5, 2026