GRGlobalRouter Docs
Console

Chat / Text / POST

Create Chat completion

Create an OpenRouter-style chat completion.

endpoint list

Mobile view shows the endpoint list. Use desktop view for parameters and examples.

MethodEndpointDescription
POST/api/v1/chat/completionsCreate an OpenRouter-style chat completion.
POST/api/v1/responsesCreate an OpenRouter-style response.
POST/api/v1/messagesCreate an OpenRouter-style message response.
POST/api/v1/embeddingsCreate OpenRouter text embeddings.
POST/api/v1/chat/completions

Requests use GlobalRouter authentication and model relations. When openrouter is selected, the provider object is forwarded to upstream OpenRouter.

Back to Chat / Text endpoint list

Request parameters

FieldTypeRequiredDescription
modelOpenRouterPublicModelIdYesGR public model ids used in request bodies.
messagesChatMessage[]YesSee the OpenAPI schema for field details.
messages[].rolestringYesAllowed values: system, user, assistant, tool.
messages[].contentstring | object[]YesSee the OpenAPI schema for field details.
providerstring | OpenRouterProviderRoutingNoSee the OpenAPI schema for field details.
max_tokensintegerNoSee the OpenAPI schema for field details.
temperaturenumberNoSee the OpenAPI schema for field details.
streambooleanNoSee the OpenAPI schema for field details.
toolsobject[]NoSee the OpenAPI schema for field details.
response_formatobjectNoSee the OpenAPI schema for field details.
openrouter_metadataobjectNoSee the OpenAPI schema for field details.

Response fields

FieldTypeRequiredDescription
idstringNoSee the OpenAPI schema for field details.
objectstringNoSee the OpenAPI schema for field details.
modelstringNoSee the OpenAPI schema for field details.
providerstringNoSee the OpenAPI schema for field details.
choicesobject[]NoSee the OpenAPI schema for field details.
usageUsageNousage.cost is the upstream cost fact when present, including 0. GR billing may apply local discounts when writing final cost.
usage.prompt_tokensintegerNoSee the OpenAPI schema for field details.
usage.completion_tokensintegerNoSee the OpenAPI schema for field details.
usage.total_tokensintegerNoSee the OpenAPI schema for field details.
usage.costnumberNousage.cost
usage.is_byokbooleanNoSee the OpenAPI schema for field details.
usage.cost_detailsobjectNoSee the OpenAPI schema for field details.
usage.prompt_tokens_detailsobjectNoSee the OpenAPI schema for field details.
usage.completion_tokens_detailsobjectNoSee the OpenAPI schema for field details.
usage.server_tool_useobjectNoSee the OpenAPI schema for field details.
openrouter_metadataOpenRouterMetadataNoSee the OpenRouterMetadata schema.
openrouter_metadata.providerstringNoSee the OpenAPI schema for field details.
openrouter_metadata.generation_idstringNoSee the OpenAPI schema for field details.

Errors

401UNAUTHORIZED

Missing or invalid Authorization Bearer token.

403FORBIDDEN

The current API key is not authorized for this scope, model, or management capability.

422VALIDATION_ERROR

The request body, path parameters, or query parameters do not match the endpoint schema.

Notes

  • Use a GlobalRouter API key; upstream OpenRouter API keys are never exposed to tenants.
  • provider is optional; an object must follow OpenRouter's native provider routing object format.
  • If upstream returns usage.cost, it is the actual upstream charge; GR billing applies local discount rules to that value.