GRGlobalRouter Docs
Console

Chat / POST

Create a chat completion

Creates a chat completion.

Endpoints

Mobile only shows the endpoint list. View parameter details and examples on desktop.

MethodEndpointDescription
POST/api/v1/chat/completionsCreates a chat completion.
POST/api/v1/chat/completionsRequests image output from a Chat call.
POST/api/v1/videosCreate an OpenRouter-compatible video job from chat context.
POST/api/v1/chat/completions

Returns full JSON by default. When `stream=true`, returns an SSE stream. If `modalities: ["image"]` is included, image results are in `choices[].message.images`.

Back to Chat endpoint list

Request parameters

FieldTypeRequiredDescription
modelstringYesGlobalRouter model ID.
messagesarrayYesMessage array, with each item containing role and content.
providerstringNo指定 GlobalRouter Provider 偏好;这里是 GR 的 provider string,不是 OpenRouter 官方 provider object。
streambooleanNoWhether to use SSE streaming output.
stream_optionsobjectNoStreaming options, such as include_usage.
temperaturenumberNo采样温度,范围 0 到 2。
top_pnumberNo核采样概率,范围 0 到 1。
max_completion_tokensintegerNoMaximum output token count.
max_tokensintegerNo最大输出 token 数,兼容旧请求;新请求优先使用 max_completion_tokens。
reasoningobjectNo推理models配置,例如 effort、summary 或 provider 支持的推理选项。
reasoning_effortstringNoreasoning.effort 的快捷字段;不能与 reasoning.effort 设置为不同值。
toolsobject[]NoTool definitions.
tool_choicestring | objectNoTool selection strategy, such as auto or a specific tool.
response_formatobjectNoStructured output configuration.
stopstring | string[]NoStop sequences.
userstringNoApplication-side user identifier.
modalitiesstring[]NoTriggers image output when image is included.
image_configobjectNoImage output configuration.
_routerobjectNoRouting metadata, such as provider or routing.

Response fields

FieldTypeRequiredDescription
idstringYesChat completion ID。
choicesobject[]YesGenerated result list.
choices[].messageobjectNoAssistant message returned for non-streaming responses.
choices[].deltaobjectNoIncremental content in streaming chunks.
usageobjectNoUsage summary for tokens or image tasks.
openrouter_metadataobjectYesMetadata such as provider and generation_id.

Notes

  • The Chat API requires an API key with the chat scope; image output also uses task capability and the corresponding model permissions.
  • `provider` 是 GlobalRouter 的 provider string;OpenRouter 官方 Chat Completion 文档中的同名字段是 object。