Responses API Responses API ステートレスなマルチターン会話、ツールコール、マルチモーダル入力に対応するOpenAI Responses API互換エンドポイント。OpenAI Python SDK ≥ 1.xのclient.responses.create()を使用するエージェントやフレームワークに最適。
POST /v1/responses
Note
Chat Completionsと同じ認証とモデルルーティングを使用。
リクエストボディ model必須
string
GET /v1/modelsに掲載されたidまたはaliasを使用します(例: "claude-sonnet-4.6"、"anthropic/claude-sonnet-4.6")。
input必須
string | Item[]
ユーザー入力 — プレーンな文字列(単一メッセージ)またはマルチターン/マルチモーダル会話用の入力アイテムの配列。
instructions
string
システムレベルの指示、システムメッセージに相当。リクエストごとに再送信が必要。
stream
boolean
trueの場合、Responses API SSEストリームイベントを返す。イベントタイプ:response.created、response.output_text.delta、response.completed。
max_output_tokens
integer
生成する最大出力トークン数(oシリーズモデルの推論トークンを含む)。
temperature
number
サンプリング値は範囲検証なしで転送されます。モデルが対応範囲外の値を制限または無視する場合があります。
top_p
number
Nucleusサンプリングの確率質量。デフォルト:1
tools
Tool[]
ツール(関数)定義 — Chat Completions と同じ JSON Schema 形式(フラットな Responses 形式とネスト形式の両方を受け付けます)。OpenAI 独自の組み込み型ホスト済みツール(web_search_preview、file_search、computer_use_preview)は非対応です。Web 検索は plugins: [{id:"web"}] で利用できます——一部のモデルルートのみ対応。
tool_choice
string | object
ツール使用の制御:"auto"、"none"、または特定のツール
parallel_tool_calls
boolean
ツール提供時の並列ファンクションコールを有効化。デフォルト:true。OpenAI系モデルのみ対応 — 下記の注記を参照。
response_format
object
構造化JSON出力を強制。構造化出力セクションを参照
previous_response_id
string
このエンドポイントはステートレスです——非 null の値を渡すと即座に 400(invalid_prompt)を返します。受け付けられて無視されることはありません。代わりにステートレスモードを使用してください:input 配列に完全な会話履歴を渡します。
リクエストスキーマ(TypeScript) 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
type ResponsesRequest = {
model : string ;
input : string | InputItem [];
instructions ?: string ;
stream ?: boolean ;
max_output_tokens ?: number ;
temperature ?: number ;
top_p ?: number ;
tools ?: Tool [];
tool_choice ?: "auto" | "none" | "required" | object ;
parallel_tool_calls ?: boolean ;
previous_response_id ?: string ;
};
type InputItem =
| { type ?: "message" ; role : "user" | "assistant" | "system" | "developer" ; content : string | ContentBlock [] }
| { type : "function_call_output" ; call_id : string ; output : string }
| { type : "function_call" ; call_id : string ; name : string ; arguments : string };
type ContentBlock =
| { type : "input_text" ; text : string }
| { type : "input_image" ; image_url : string ; detail ?: "auto" | "low" | "high" };
⌄ 全 24 行を表示リクエスト例 cURL Python Multi-turn Streaming
curl https://api.bazaarlink.ai/v1/responses \
-H "Authorization: Bearer $BAZAARLINK_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.4-mini",
"instructions": "You are a helpful assistant.",
"input": "What is the capital of Taiwan?"
}'
⌄ 全 8 行を表示レスポンス形式 BazaarLinkは標準化されたレスポンスを返し、アップストリーム固有のフィールドを削除します。レスポンス内の不透明なBazaarLinkリクエストIDはx-request-idと一致します。GET /v1/generationで使用してください。非ストリーミングのレスポンスでは、同じIDがx-generation-idにも返されます。usage.costはお客様に請求されたUSD金額です。統計は完了後数秒かかる場合があるため、404は短時間再試行してください。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
type ResponsesResponse = {
id : string ;
object : "response" ;
created_at : number ;
completed_at : number ;
status : "completed" | "failed" | "incomplete" ;
model : string ;
output : OutputItem [];
usage : {
input_tokens : number ;
output_tokens : number ;
total_tokens : number ;
cost ?: number ;
} | null ;
error : null | { code : string ; message : string };
};
type OutputItem =
| {
type : "message" ;
id : string ;
role : "assistant" ;
status : "completed" ;
content : Array <{ type : "output_text" ; text : string ; annotations : [] }>;
}
| { type : "function_call" ; id : string ; call_id : string ; name : string ; arguments : string ; status : "completed" };
⌄ 全 27 行を表示Chat Completionsからの移行 messagesをinput(文字列または配列)に置き換え、システムロールメッセージの代わりにinstructionsを使用し、choices[0].message.contentの代わりにoutput[0].content[0].textを読み取ります。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
response = client.chat.completions.create(
model="openai/gpt-5.4-mini" ,
messages=[
{"role" : "system" , "content" : "You are helpful." },
{"role" : "user" , "content" : "Hello" },
]
)
text = response.choices[0 ].message.content
response = client.responses.create(
model="openai/gpt-5.4-mini" ,
instructions="You are helpful." ,
input ="Hello"
)
text = response.output[0 ].content[0 ].text
⌄ 全 17 行を表示制限事項 previous_response_id または store: true を渡すと 400(エラーコード invalid_prompt)を返します——受け付けられて無視されるわけではありません。常にステートレスモードを使用し、input 配列に完全な会話履歴を渡してください。 OpenAI 独自の組み込み型ホスト済みツール(web_search_preview、file_search、computer_use_preview)は非対応です。Web 検索は plugins: [{id:"web"}] で利用できます——一部のモデルルートのみ対応。 background: true は受け付けられますが無視されます——すべてのリクエストは完了まで同期的に実行されます。