https://api.lazu.ai/v1/responsesResponses API
Responses は reasoning models、multimodal input、Lazu file_id dereferencing に適しています。uploaded files や新しい OpenAI response features が必要な場合に推奨します。
課金選択したモデルとレーンの料金でトークン使用量を計算します。他の課金項目が適用される場合もあります。 料金とレーン ↗
使い分け
Responses を使う
uploaded files、reasoning controls、document workflows、server-side normalized multimodal inputs。
Chat completions を使う
simple chat、SDK compatibility、tool calling、既存の
/v1/chat/completions ベースのアプリ。
Request body
modelstringrequired/api/models/catalog の model ID。
supported_endpoints に /v1/responses のパスを含む model
を優先してください。
inputstring | object[]requiredtext input または response input messages array。
instructionsstringnullableresponse の system-level instructions。
reasoningobjectnullablesupported models で reasoning effort を制御します。例:
{"effort":"medium"}。
toolsobject[]nullableOpenAI-compatible Responses shape の tool definitions。
streambooleannullablemodel が対応する場合、response events stream を返します。
max_output_tokensintegernullablegenerated output tokens の上限。
File dereferencing
Files で upload した file_id を参照できます。
dereference が発生した場合、Lazu は X-Lazu-File-Dereference: 1 を付けます。
制限:
- single file purpose limit は引き続き適用されます。
- 1 回の Responses call で dereference される files は合計 64 MB 未満。
- Chat completions は
file_idを自動 dereference しません。
Stateless compatibility bridge
一部の catalog entry は lossless Chat bridge 経由で Responses を提供します。
supported_endpoints[].mode で確認できます。この route では
store 省略時は成功し
X-Lazu-Warning: stateless_bridge を返し、
store: false は warning なしで成功します。明示的な
store: true、保持できない state field、未知の cross-protocol
field は upstream call 前に 400 protocol_bridge_unsupported
になります。標準 Responses body に Lazu 独自 field は追加しません。
Response
idstringResponse ID。
outputobject[]output messages、reasoning items、tool calls、その他 response events。
usage.input_tokensintegernullableupstream が usage を返す場合の input token count。
usage.output_tokensintegernullableupstream が usage を返す場合の output token count。
完全な照合には同じ API Key で
GET /api/usage/requests/{request_id} を使ってください。
ツール結果を含む完全な往復
キーのカタログから Responses と関数ツールに対応するモデルを選び、LAZU_API_KEY と LAZU_MODEL を設定します。ステートレスな継続では reasoning を含む全 output item を保持し、同じ call_id でツール結果を追加します。ブリッジで保持できない暗号化状態やプロバイダー固有状態はネイティブ経路が必要です。
import json
import os
from openai import OpenAI, APIStatusError
client = OpenAI(
api_key=os.environ["LAZU_API_KEY"],
base_url=os.environ.get("LAZU_BASE_URL", "https://api.lazu.ai/v1"),
max_retries=0,
)
model = os.environ["LAZU_MODEL"]
tools = [{"type": "function", "name": "add", "description": "Add two integers",
"parameters": {"type": "object", "properties": {
"a": {"type": "integer"}, "b": {"type": "integer"}},
"required": ["a", "b"], "additionalProperties": False}}]
history = [{"role": "user", "content": "Use add to calculate 2 + 3."}]
try:
first = client.responses.create(model=model, input=history, tools=tools,
tool_choice={"type": "function", "name": "add"}, store=False,
max_output_tokens=1024)
history.extend(item.model_dump(exclude_unset=True) for item in first.output)
for item in first.output:
if item.type == "function_call":
if item.name != "add":
raise ValueError("Unexpected tool")
args = json.loads(item.arguments)
history.append({"type": "function_call_output", "call_id": item.call_id,
"output": json.dumps({"result": args["a"] + args["b"]})})
final = client.responses.create(model=model, input=history, tools=tools,
tool_choice="none", store=False, max_output_tokens=1024)
print(final.output_text)
except APIStatusError as exc:
print(exc.status_code, exc.response.headers.get("x-lazu-request-id"), exc.body)
raise出力を受信した後は自動再送しないでください。413 request_body_too_large はリクエストを縮小し、503 gateway_overloaded は時間を置いて再試行します。後者はプロバイダー障害を意味しません。部分用量はリクエスト詳細で照合できます。
curl https://api.lazu.ai/v1/responses \
-H "Authorization: Bearer $LAZU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-luna",
"input": [{
"role": "user",
"content": [
{"type": "input_text", "text": "Say hi"}
]
}]
}'
{
"id": "resp_01ABCDEF",
"model": "gpt-6-luna",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{ "type": "output_text", "text": "Hi!" }]
}
],
"usage": { "input_tokens": 9, "output_tokens": 2 }
}
- Request ID
- req_demo_01
- モデル · レーン
- gpt-6-luna · stable
- トークン · 入力 / 出力
- 1,200 / 320
- キー
- demo-key
例示のみで、見積もりでもあなたのリクエストの結果でもありません。上のリクエストを送信すると自分の明細が表示されます。
実際のリクエスト明細を見る →向いている用途
- Reasoning models
- Uploaded PDFs or images
- Structured multimodal input