Chat Completions API
/v1/models が返したモデル識別子を使い、OpenAI 互換の messages ペイロードを /v1/chat/completions へ送ります。
curl https://api.foxora.ai/v1/chat/completions \
-H "Authorization: Bearer $FOXORA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "<model-id-from-v1-models>",
"messages": [
{"role": "user", "content": "Summarize this in three bullets."}
]
}'- プロバイダーモデルを固定せず、現在のモデル一覧を取得します。
- 空でない
modelと、順序付きのmessagesを送ります。 - アシスタント結果を
choices、計測情報をusageから読みます。 - リクエスト失敗時は
x-request-idを保全します。
クライアントが Server-Sent Events を処理し、途中で終わるストリームにも対応できる場合だけ stream: true を設定します。
期待される結果: HTTP 成功応答に、完了したリクエストのアシスタント選択肢と利用データが含まれます。