跳转到主要内容
厂商: OpenAI Model ID: gpt-5-4-mini 能力: 128K 上下文 · 工具调用 · 视觉 · 流式 · 结构化输出 计价: 按 token,mini 档(实时费率 GPT-5.4-mini 介于 GPT-5-miniGPT-5.4 之间:mini 档价位 + 5.4 的更紧结构化 输出和 tool-call 参数生成。生产抽取和 agent 循环的正确默认款 —— 当你想要 5.4 的质量提升,又不想为标准档付费时。

Request

curl https://llm.bytespike.ai/v1/chat/completions \
  -H "Authorization: Bearer $BYTESPIKE_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-5-4-mini",
    "messages": [{"role": "user", "content": "Extract the dollar amounts from this invoice."}],
    "response_format": {"type": "json_object"}
  }'

Body 参数

字段类型必填默认说明
modelstringgpt-5-4-mini
messagesarray
max_tokensinteger模型上限最大值:16384。
toolsarray并行 function calling。
response_formatobjectJSON / 结构化输出。
streambooleanfalseSSE 流式。

Response

{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "gpt-5-4-mini",
  "choices": [{"index": 0, "message": {"role": "assistant", "content": "{\"amounts\": [142.50, 89.00]}"}, "finish_reason": "stop"}],
  "usage": {"prompt_tokens": 87, "completion_tokens": 24, "total_tokens": 111}
}

代码示例

curl https://llm.bytespike.ai/v1/chat/completions \
  -H "Authorization: Bearer $BYTESPIKE_API_KEY" \
  -H "content-type: application/json" \
  -d '{"model": "gpt-5-4-mini", "messages": [{"role": "user", "content": "Extract amounts as JSON."}], "response_format": {"type": "json_object"}}'

流式与缓存

"stream": true 走 SSE。自动 prompt caching。

Errors

Code触发条件是否计费
400 / 401 / 402 / 422 / 429标准
5xx上游否(自动重试)

何时选用

  • 5-mini 质量见顶后的生产抽取与结构化输出场景。
  • 对参数紧致度有要求的工具调用 agent 步骤。
  • 想在小规模下更低延迟,见 GPT-5.4-nano
  • 想要更高能力,见 GPT-5.4GPT-5.5

限制

上下文窗口128K tokens
最大输出16384 tokens
支持工具调用是(并行)
支持视觉
支持流式
支持 prompt caching自动