POST /v1/chat/completions
Create a chat completion
Generate a model response for the supplied conversation. The `model` field is a tenant-scoped **alias**; the gateway resolves it to a backing model. Set `stream: true` to receive the response incrementally as Server-Sent Events (see the streaming note below); otherwise a single JSON completion is returned.
Request body
Content type application/json · schema ChatCompletionRequest
Minimal request
{
"model": "general",
"messages": [
{
"role": "user",
"content": "月次レポートの要点を3つにまとめてください。"
}
]
}
With optional parameters
{
"model": "secure",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Summarize this contract clause."
}
],
"max_tokens": 512,
"temperature": 0.2
}
Responses
200 A chat completion. When `stream` is `false` (or omitted) the body is a single JSON object. When `stream` is `true` the response is an `text/event-stream` of incremental chunks (see the streaming note).
application/json, text/event-stream · schema ChatCompletion
Server-Sent Events. Each `data:` line carries a `chat.completion.chunk` JSON object whose `choices[].delta` holds the incremental content. The stream terminates with a final `data: [DONE]` sentinel.
Non-streaming completion
{
"id": "chatcmpl-2f8c0b9e-6a1d-4c2e-9b3a-7d5e1f0a2b3c",
"object": "chat.completion",
"created": 1718841600,
"model": "general",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "要点は次の3つです。…"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 42,
"completion_tokens": 128,
"total_tokens": 170
}
}
400 Malformed request (invalid JSON or schema violation).
application/json · schema Error
Example
{
"error": {
"type": "invalid_request_error",
"message": "Invalid chat completion request.",
"code": "invalid_request"
}
}
403 The request was refused. Either the API key is not authorized to invoke chat completions, or the content was blocked by a policy.
application/json · schema Error
API key lacks the chat scope
{
"error": {
"type": "invalid_request_error",
"message": "This API key is not authorized to invoke chat completions.",
"code": "insufficient_scope"
}
}
Blocked by content policy
{
"error": {
"type": "invalid_request_error",
"message": "Your request was blocked by a content policy.",
"code": "content_blocked"
}
}
404 The requested model alias does not exist or is not available to this tenant.
application/json · schema Error
Example
{
"error": {
"type": "model_not_found",
"message": "The requested model was not found.",
"code": "model_not_found"
}
}
429 The model alias is temporarily rate limited. Retry with backoff.
application/json · schema Error
Example
{
"error": {
"type": "rate_limited",
"message": "The requested model alias 'general' is temporarily unavailable.",
"code": "rate_limited"
}
}
502 The request could not be completed against the backing model.
application/json · schema Error
Example
{
"error": {
"type": "upstream_unavailable",
"message": "The requested model alias 'general' is temporarily unavailable.",
"code": "upstream_unavailable"
}
}
GET /v1/models
List available model aliases
Return the model aliases the calling tenant is permitted to use. Each entry is identified by its alias `id`; no provider, upstream model, or region is disclosed.
Responses
200 The list of model aliases available to the tenant.
application/json · schema ModelList
Example
{
"object": "list",
"data": [
{
"id": "general",
"object": "model",
"display_name": "General",
"description": "汎用的な業務向けアシスタント。"
},
{
"id": "secure",
"object": "model",
"display_name": "Secure",
"description": "機密性の高い業務向けの厳格な構成。"
}
]
}