メインコンテンツへスキップ
POST
/
v1
/
chat
/
completions
チャット補完を作成
curl --request POST \
  --url https://apiany.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-5.4",
  "messages": [
    {
      "role": "user",
      "content": "Write a concise product tagline for APIAny.AI."
    }
  ],
  "temperature": 0.7
}
'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {}
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "input_tokens": 123,
    "output_tokens": 123,
    "cached_input_tokens": 123
  }
}

承認

Authorization
string
header
必須

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

ボディ

application/json
model
string
必須
:

"gpt-5.4"

messages
object[]
必須
temperature
number

サンプリング温度。

必須範囲: 0 <= x <= 2
top_p
number

核サンプリングの累積確率。

必須範囲: 0 <= x <= 1
max_tokens
integer

レスポンスの最大トークン数。

必須範囲: x >= 1
stop

最大 4 個の停止シーケンス。

n
integer

生成する候補数。

必須範囲: x >= 1
frequency_penalty
number
必須範囲: -2 <= x <= 2
presence_penalty
number
必須範囲: -2 <= x <= 2
seed
integer

できる限り再現可能なサンプリングシード。

response_format
object

JSON オブジェクトまたは JSON Schema 出力を強制します(例: { "type": "json_object" })。

tools
object[]

モデルが呼び出せるツール/関数の宣言。

tool_choice

ツール選択: 'auto' | 'none' | 'required' | { type: 'function', function: { name } }。

logprobs
boolean
top_logprobs
integer
必須範囲: 0 <= x <= 20
logit_bias
object
user
string

リスク監査のためのエンドユーザー識別子。

stream
boolean

true の場合、増分を SSE でストリーミング返却します(OpenAI chat.completion.chunk)。'data: [DONE]' で終了します。

レスポンス

OpenAI 互換のチャット補完レスポンス。

id
string
必須
object
string
必須
:

"chat.completion"

created
integer
必須
model
string
必須
choices
object[]
必須
usage
object