Chat de Claude
post/v1/messages
Formato de la API Messages de Anthropic. El encabezado de solicitud anthropic-version es obligatorio.
Autenticación
Envía tu clave de API de OLETOKEN como token Bearer. Las claves se crean en la página Claves de API de la consola.
Authorization: Bearer $OLETOKEN_API_KEYParámetros
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| anthropic-versionheader | string | Versión de la API de Anthropic | |
| x-api-keyheader | string | — | Clave de API de Anthropic (opcional; también funciona un token Bearer) |
Cuerpo de la solicitud
Content-Type:application/json
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| 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 | — | — |
Respuestas
200Respuesta creada
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| 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 | — | — |
Solicitud de ejemplo
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
}'
