Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
エンドポイント / OpenAI-compatible

Chat completions

POST/v1/chat/completions

Lazu 経由で OpenAI-compatible chat request を送ります。Base URL、認証、必須 body fields、stream、tools、response usage、troubleshooting をこのページで確認できます。

基本設定

Base URL

OpenAI SDK では https://api.lazu.ai/v1 を使います。直接呼ぶ場合は https://api.lazu.ai/v1/chat/completions です。

モデル検出

実行時に GET /api/models/catalog を読み、 supported_endpoint_typeschat を含むモデルを選びます。

Request body

modelstring
required

model ID、route alias、または route policy name。明示的な model は GET /api/models/catalog から選びます。

messagesobject[]
required

OpenAI shape の会話メッセージ配列です。

rolestring
system、user、assistant、tool のいずれか。
contentstring | content_part[]
plain text または multimodal content parts。
tool_call_idstring
tool message を先行 tool call と関連付けます。
streamboolean
nullable

true の場合、Server-Sent Events stream を返し、最後に data: [DONE] を送ります。

toolsobject[]
nullable

tool 定義です。送信前に catalog の parameters.tools を確認してください。

type"function"
現在は function tools を扱います。
function.namestring
モデルが呼べる tool name。
function.parametersobject
tool arguments の JSON Schema。
tool_choicestring | object
nullable

autonone、指定 tool object など。

response_formatobject
nullable

structured output control。例:{"type":"json_object"}

temperaturenumber
nullable

sampling temperature。多くの model は 0 から 2 を受け付けます。

max_tokensinteger
nullable

生成 token の上限です。

Vision input

画像入力は OpenAI-compatible content parts を使います。HTTPS image URL または data URL を送れます。

Image input
json
{
"model": "gpt-4o",
"messages": [
  {
    "role": "user",
    "content": [
      {"type": "text", "text": "What's in this image?"},
      {
        "type": "image_url",
        "image_url": {"url": "data:image/png;base64,..."}
      }
    ]
  }
]
}

PDF や大きな document は Files で upload し、 Responses で参照してください。Chat completions は

file_id を自動 dereference しません。

Response

idstring

Lazu または provider response ID。

choicesobject[]

assistant output choices。Streaming では incremental delta です。

usage.prompt_tokensinteger

input token count。

usage.completion_tokensinteger

generated output token count。

usage.prompt_tokens_details.cached_tokensinteger
nullable

provider が報告した cache read tokens。

完全な照合には リクエスト詳細 を使ってください。