Claude Sonnet 5.5
This page is generated from the upstream official OpenAPI documentation. Endpoints, parameters and examples match the official docs; brand and API domain are replaced with ModelFold.
Endpoint
POST /claude/v1/messages
Full URL: https://ai.modelfold.online/claude/v1/messages
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
Streaming Support
When stream: true is set in the request, the API returns responses as server-sent events (SSE). Claude tool calling responses stream tool_use blocks and input_json_delta fragments.
Streaming Response Format:
- Content-Type:
text/event-stream - Event names include
message_start,content_block_start,content_block_delta,message_delta, andmessage_stop - Tool calls are emitted as
tool_usecontent blocks - Final stop reason is often
tool_usefor function-calling requests
Features
- Standard chat with
messages. - Function calling with
toolsandinput_schema. - Optional stream response with Claude events.
- Optional thinking flag (
thinkingFlag).
Request Notes
- Put the current model name in the
modelfield. - Use
messagesfor conversation history. - Use
toolsto declare callable functions. - Set
streamtotruefor SSE output.
Authentication
Authentication: send Authorization: Bearer YOUR_API_KEY. Clients that send x-api-key (such as the Anthropic SDK) must set it to Bearer YOUR_API_KEY. anthropic-version is optional.
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model id for this page, e.g. claude-sonnet-5-5. Available ids are listed by GET https://ai.modelfold.online/v1/anthropic/v1/models%60. Allowed values:claude-sonnet-5-5。 示例:claude-sonnet-5-5`。 |
messages | array<object> | Yes | Conversation messages in chronological order. |
messages[].role | string | Yes | Message role. Allowed values:user / assistant。 示例:user。 |
messages[].content | `string | array<object>` | Yes |
tools | array<object> | No | Optional callable tools. Each tool includes a name, description, and input_schema. |
tools[].name | string | Yes | Function name. 示例:get_current_weather。 |
tools[].description | string | Yes | Human-readable function description. 示例:Get the current weather in a given location。 |
tools[].input_schema | object | Yes | JSON Schema for function parameters. |
tools[].input_schema.type | string | No | Schema type. 示例:object。 |
tools[].input_schema.properties | object | No | Function parameter definitions. |
tools[].input_schema.required | array<string> | No | Required parameter names. |
thinkingFlag | boolean | No | Whether to enable thinking. 示例:true。 |
stream | boolean | No | If set to true, the response is returned as an SSE stream. Default:true。 示例:false。 |
max_tokens | number | No | Optional Claude output token limit. Leave empty to use the default of 4096. Default:4096。 示例:4096。 |
Request Example
bash
curl -X POST "https://ai.modelfold.online/claude/v1/messages" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [
{
"role": "user",
"content": "What is the weather like in Boston today?"
}
],
"tools": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. Boston, MA"
}
},
"required": [
"location"
]
}
}
],
"thinkingFlag": true,
"stream": false,
"max_tokens": 4096
}'json
{
"model": "claude-sonnet-5-5",
"messages": [
{
"role": "user",
"content": "What is the weather like in Boston today?"
}
],
"tools": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. Boston, MA"
}
},
"required": [
"location"
]
}
}
],
"thinkingFlag": true,
"stream": false,
"max_tokens": 4096
}Response
200 — Request successful.
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
role | string | 否 | Returned message role 示例:assistant。 |
usage | object | 否 | Usage information returned in the response |
usage.input_tokens | integer | 否 | Input token count 示例:600。 |
usage.output_tokens | integer | 否 | Output token count 示例:57。 |
usage.cache_creation_input_tokens | integer | 否 | Cache creation input token count 示例:0。 |
usage.cache_read_input_tokens | integer | 否 | Cache read input token count 示例:0。 |
usage.service_tier | string | 否 | Service tier 示例:standard。 |
stop_reason | string | 否 | Reason why generation stopped 示例:tool_use。 |
model | string | 否 | Actual model version returned in the response 示例:claude-opus-4-5-20251101。 |
id | string | 否 | Unique message identifier 示例:msg_01VSoxV4a8YWB3DBh9TdM63W。 |
credits_consumed | number | 否 | Credits consumed by the request 示例:0.25。 |
type | string | 否 | Top-level response object type 示例:message。 |
content | array<object> | 否 | Response content blocks |
content[].input | object | 否 | Tool input arguments |
content[].caller | object | 否 | Tool caller metadata |
content[].caller.type | string | 否 | 示例:direct。 |
content[].name | string | 否 | Tool name 示例:get_current_weather。 |
content[].id | string | 否 | Tool call identifier 示例:toolu_018gdqs2FHxrRjQHLZv1qvbF。 |
content[].type | string | 否 | Content block type 示例:tool_use。 |
json
{
"role": "assistant",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"output_tokens": 57,
"service_tier": "standard",
"cache_creation_input_tokens": 0,
"input_tokens": 600,
"cache_read_input_tokens": 0,
"inference_geo": "not_available"
},
"stop_reason": "tool_use",
"model": "claude-sonnet-5-5",
"id": "msg_01VSoxV4a8YWB3DBh9TdM63W",
"credits_consumed": 0.14,
"type": "message",
"content": [
{
"input": {
"location": "Beijing, China"
},
"caller": {
"type": "direct"
},
"name": "get_current_weather",
"id": "toolu_018gdqs2FHxrRjQHLZv1qvbF",
"type": "tool_use"
}
]
}400 — Bad Request - Invalid request parameters
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | 否 | — |
error.message | string | 否 | 示例:Invalid request parameters。 |
error.type | string | 否 | 示例:invalid_request_error。 |
json
{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}401 — Unauthorized - Invalid or missing API key
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | 否 | — |
error.message | string | 否 | 示例:Invalid or missing API key。 |
error.type | string | 否 | 示例:authentication_error。 |
json
{
"error": {
"message": "Invalid or missing API key",
"type": "authentication_error"
}
}