NNexithDocs
ステータスダッシュボード ↗
概要とクイックスタートモデルカタログガイドAPI リファレンス連携OAuth2 / OIDC

Responses

POST /v1/responses · OpenAI Responses 互換(リクエスト形状で振り分け)

/v1/responses は主に Codex など Responses API しか話さないクライアントにサービスを提供します。ゲートウェイはリクエスト形状で 送信元を判断します:

  • Codex 形状(instructions / tools / reasoning / input メッセージ配列を持つ)→ 内部的に Chat Completions に翻訳して実行し、結果を object: "response" 形状に翻訳し直します。
  • 通常テキスト形状(input が文字列)→ OpenAI の chat.completion 形状を返します(/v1/chat/completions と同一)。Codex 以外の呼び出し元が再利用しやすくなります。

リクエスト#

POST /v1/responses
Authorization: Bearer nx-...
Content-Type: application/json

Body(共通)#

フィールド 型 必須 説明
model string — デフォルト nexith(nexith-core にマッピング)
input string | array ✅ 文字列、または Responses input item 配列
stream bool — デフォルト false
max_output_tokens integer — 推論 + 本文の合計予算。小さすぎると本文が空になります
previous_messages array — 任意の複数ターン履歴(Nexith 拡張、Chat 形状)

Codex 形状の追加フィールド#

フィールド 説明
instructions トップレベルの指示。system メッセージに翻訳されます
tools Responses ツール定義({type:"function", name, parameters})。Chat tools に翻訳されます
tool_choice auto / none / required / 関数指定
reasoning {effort: ...}。reasoning_effort に翻訳されます

input items#

[
  {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "hello"}]},
  {"type": "message", "role": "user", "content": [{"type": "input_image", "image_url": "https://…"}]},
  {"type": "function_call_output", "call_id": "call_1", "output": "42"}
]

input_text、input_image、message、function_call、function_call_output をサポートします。


レスポンス(Codex 形状)#

{
  "id": "resp_nx0000000000000001",
  "object": "response",
  "created_at": 1795055384,
  "model": "nexith-core",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "id": "msg_nx0000000000000000",
      "role": "assistant",
      "status": "completed",
      "content": [{"type": "output_text", "text": "ok", "annotations": []}]
    }
  ],
  "usage": {"input_tokens": 324, "output_tokens": 32, "total_tokens": 356}
}
  • status:completed / incomplete(max_output_tokens 到達時など)。
  • ツール呼び出しの出力は function_call item です。

レスポンス(通常テキスト形状)#

Chat Completions と完全に一致します(object: "chat.completion")。


ストリーミング#

stream=true は SSE を返します。Codex 形状のストリームは Responses イベントを出力し、テキスト形状のストリームは chat.completion.chunk です。フレームの詳細はストリーミングプロトコルを参照してください。


例#

curl https://api.nexith.ai/v1/responses \
  -H "Authorization: Bearer $NEXITH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nexith-core",
    "instructions": "You are a helpful coding agent.",
    "input": [{"type":"message","role":"user","content":[{"type":"input_text","text":"say ok"}]}],
    "max_output_tokens": 256
  }'

max_output_tokens は隠れた推論を含みます。推論モデルでは 512 以上を推奨します。小さすぎると status: "incomplete" になり、本文が空になります。


クライアント設定#

Codex CLI#

# ~/.codex/config.toml
[model_providers.nexith]
name = "Nexith"
base_url = "https://api.nexith.ai/v1"
env_key = "NEXITH_API_KEY"
wire_api = "responses"

詳細は Codex 導入 を参照してください。