Claude chat
post/v1/messages
Anthropic Claude Messages API format. The anthropic-version request header is required.
Authentication
Send your OLETOKEN API key as a Bearer token. Keys are created on the API Keys page of the console.
Authorization: Bearer $OLETOKEN_API_KEYParameters
| Field | Type | Required | Description |
|---|---|---|---|
| anthropic-versionheader | string | Anthropic API version | |
| x-api-keyheader | string | — | Anthropic API key (optional; a Bearer token also works) |
Request body
Content-Type:application/json
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | — | |
| messages | ClaudeMessage[] | — | |
| role | stringuserassistant | — | |
| content | string | object[] | — | |
| type | stringtextimagetool_usetool_result | — | — |
| text | string | — | — |
| source | object | — | — |
| type | stringbase64url | — | — |
| media_type | string | — | — |
| data | string | — | — |
| url | string | — | — |
| id | string | — | — |
| name | string | — | — |
| input | object | — | — |
| tool_use_id | string | — | — |
| content | string | — | — |
| system | string | object[] | — | — |
| cache_control | object | — | — |
| inference_geo | string | — | — |
| max_tokens | integer≥ 1 | — | |
| temperature | number0–1 | — | — |
| top_p | number | — | — |
| top_k | integer | — | — |
| stream | boolean | — | — |
| stop_sequences | string[] | — | — |
| tools | object[] | — | — |
| name | string | — | — |
| description | string | — | — |
| input_schema | object | — | — |
| tool_choice | object | — | — |
| type | stringautoanytoolnone | — | — |
| name | string | — | — |
| thinking | object | — | — |
| type | stringenableddisabled | — | — |
| budget_tokens | integer | — | — |
| context_management | object | — | — |
| output_config | object | — | — |
| output_format | object | — | — |
| container | string | object | — | — |
| mcp_servers | object[] | — | — |
| metadata | object | — | — |
| user_id | string | — | — |
| speed | stringstandardfast | — | — |
| service_tier | stringautostandard_only | — | — |
Responses
200Response created
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | — | — |
| type | string | — | — |
| role | string | — | — |
| content | object[] | — | — |
| type | string | — | — |
| text | string | — | — |
| model | string | — | — |
| stop_reason | stringend_turnmax_tokensstop_sequencetool_use | — | — |
| usage | object | — | — |
| input_tokens | integer | — | — |
| output_tokens | integer | — | — |
| cache_creation_input_tokens | integer | — | — |
| cache_read_input_tokens | integer | — | — |
Example request
curl -X POST 'https://api.oletoken.ai/v1/messages' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'anthropic-version:' \
-H 'x-api-key:' \
-H 'Content-Type: application/json' \
-d '{
"model": "claude-3-opus-20240229",
"messages": [],
"max_tokens": 0
}'
