Skip to content
bestokens

チャット補完

リクエストとレスポンスのリファレンス。

最終更新: 2026-10-27

POST /v1/chat/completions accepts the same request body as the OpenAI Chat Completions API. Parameters we do not support are rejected with a 400 rather than silently ignored.

Request parameters

FieldTypeRequiredNotes
modelstringyesAny model id from GET /v1/models
messagesarrayyesRoles: system, user, assistant, tool
streambooleannoWhen true, returns text/event-stream
temperaturenumberno0–2, provider default when omitted
max_tokensintegernoClamped to the model max output
toolsarraynoFunction calling, OpenAI schema
tool_choicestring | objectnoauto, none, required or a named tool
response_formatobjectno{"type":"json_object"} on supported models
seedintegernoBest-effort determinism

Response shape

              {
  "id": "chatcmpl-bs-9f2c1a",
  "object": "chat.completion",
  "created": 1761523200,
  "model": "gpt-5-mini",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "Edge computing processes data near its source." },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 18, "completion_tokens": 11, "total_tokens": 29 }
}
            

Compatibility notes

  • The response is passed through from the upstream provider with the model field normalized to the id you requested.
  • usage is always present, including on streamed responses, so you can reconcile cost locally.
  • Legacy /v1/completions (text completion) is not offered. Use chat completions with a single user message.
  • Embeddings are available at POST /v1/embeddings for embedding models only.

技術ドキュメントは英語で提供しています。