Introduction

文字

Claude Opus 4.6Claude Opus 4.7Claude Opus 4.8Claude Opus 5Claude Opus 5.5

圖片

StarmodelStarmodel
開始使用API 參考
claude-opus

Claude Opus 5.5 · 對話補全

文字 / Claude / Claude Opus 5.5 / 對話補全

POST/v1/chat/completions

請求參數

Authorization

在 Header 加入參數 Authorization,其值為 Bearer 之後拼接你的 API Key。

Authorization: Bearer ****************
Header 參數
Content-Typestring可選
application/json
Acceptstring可選
application/json
Body 參數application/json必填
modelstring必需
模型 ID,固定為 `claude-opus-5-5`
messagesarray[object]必需
對話訊息列表,每條含 `role`(system / user / assistant)與 `content`
streambool可選
是否串流回傳(SSE),預設 `false`
temperaturenumber可選
取樣溫度,越大越隨機
top_pnumber可選
核採樣,與 `temperature` 二選一。範圍 `0`–`1`
max_tokensint可選
最大生成 token 數
stoparray可選
停止序列;命中任一即停止輸出
toolsarray可選
工具 / 函式定義(function calling)
tool_choicestring/object可選
是否及呼叫哪個工具:`auto` / `none` / 指定工具
response_formatobject可選
約束輸出格式,例如強制輸出 JSON 物件
userstring可選
終端使用者識別,用於濫用監控
範例
{  "model": "claude-opus-5-5",  "messages": [    {      "role": "user",      "content": "你好,介紹一下你自己"    }  ]}

請求範例程式碼

curl https://api.starmodel.ai/v1/chat/completions \  -H "Authorization: Bearer $API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-opus-5-5",    "messages": [      {        "role": "user",        "content": "你好,介紹一下你自己"      }    ]  }'

回應

200 · 成功
idstring必需
本次回應的唯一 id
objectstring必需
物件類型
createdinteger必需
建立時間戳(秒)
modelstring必需
實際使用的模型
choicesarray[object]必需
生成結果列表
usageobject必需
本次呼叫的 token 用量
範例
{  "id": "chatcmpl-xxx",  "object": "chat.completion",  "created": 1730000000,  "model": "claude-opus-5-5",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "你好!很高興見到你……"      },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 12,    "completion_tokens": 24,    "total_tokens": 36  }}

On this page

請求參數請求範例程式碼回應
{
  "model": "claude-opus-5-5",
  "messages": [
    {
      "role": "user",
      "content": "你好,介紹一下你自己"
    }
  ]
}
curl https://api.starmodel.ai/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5-5",
    "messages": [
      {
        "role": "user",
        "content": "你好,介紹一下你自己"
      }
    ]
  }'
{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1730000000,
  "model": "claude-opus-5-5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "你好!很高興見到你……"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 24,
    "total_tokens": 36
  }
}