claude-sonnet
Claude Sonnet 4.5 · Chat completions
Text / Claude / Claude Sonnet 4.5 / Chat completions
POST
/v1/chat/completionsRequest parameters
Authorization
Add an Authorization header whose value is Bearer followed by your API key.
Authorization: Bearer ****************
Header parameters
Content-TypestringOptional
application/json
AcceptstringOptional
application/json
Body parametersapplication/jsonrequired
modelstringRequired
Model ID, fixed to `claude-sonnet-4-5-20250929`
messagesarray[object]Required
List of conversation messages; each has `role` (system / user / assistant) and `content`
streamboolOptional
Whether to stream the response (SSE), default `false`
temperaturenumberOptional
Sampling temperature; higher is more random
top_pnumberOptional
Nucleus sampling; alternative to `temperature`. Range `0`–`1`
max_tokensintOptional
Maximum number of generated tokens
stoparrayOptional
Stop sequences; output halts when any is produced
toolsarrayOptional
Tool / function definitions for function calling
tool_choicestring/objectOptional
Whether and which tool to call: `auto` / `none` / a named tool
response_formatobjectOptional
Constrain the output format, e.g. force a JSON object
userstringOptional
End-user identifier, used for abuse monitoring
Example
{ "model": "claude-sonnet-4-5-20250929", "messages": [ { "role": "user", "content": "Hi, tell me about yourself" } ]}Request code samples
curl https://api.starmodel.ai/v1/chat/completions \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-5-20250929", "messages": [ { "role": "user", "content": "Hi, tell me about yourself" } ] }'Response
200 · Success
idstringRequired
Unique id of this response
objectstringRequired
Object type
createdintegerRequired
Creation timestamp (seconds)
modelstringRequired
Model actually used
choicesarray[object]Required
List of generated results
usageobjectRequired
Token usage of this call
Example
{ "id": "chatcmpl-xxx", "object": "chat.completion", "created": 1730000000, "model": "claude-sonnet-4-5-20250929", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hi! Nice to meet you…" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 24, "total_tokens": 36 }}
