Messages & token counting
Use Anthropic-style messages, content blocks, and token estimates.
/v1/messagesapi.17.wtfRequest body
| Parameter | Type / requirement | Description |
|---|---|---|
model | string · required | Text model ID. |
messages | array · required | user or assistant messages with text or content blocks. |
max_tokens | positive integer · required | Maximum generated tokens. |
system | string or text-block array · optional | System prompt outside messages. |
temperature, top_p | number · optional | Model-dependent sampling controls. |
stop_sequences | string[] · optional | Stop sequences. |
stream | boolean · optional | Defaults to false. |
tools | array · optional | name, description, and input_schema. |
tool_choice | object · optional | type: auto, any, none, or tool with a name. |
thinking | object · optional | Model-dependent thinking configuration; budget_tokens must be positive. |
reasoning_effort | string · optional | output_config.effort is a fallback alias. |
Example request
Use a model key in x-api-key and the Anthropic version header.
curl https://api.17.wtf/v1/messages \
-H "x-api-key: $LM0_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"max_tokens": 512,
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}' Content & response blocks
Read generated text from content blocks where type is text. Other supported blocks include images, tool_use, tool_result, and thinking. Base64 images use source.type: base64, media_type, and data; URL images use source.type: url and url. Inspect stop_reason and usage.input_tokens / usage.output_tokens. Provider-specific server tool blocks and redacted thinking are not round-tripped.
Count input tokens
POST /v1/messages/count_tokens accepts model, messages, and optional system using the Messages format. Include a valid text model ID so access and routing can be resolved. The gateway uses native Anthropic counting where possible and a coarse local estimate otherwise. Treat the result as an estimate, not a billing quote.
curl https://api.17.wtf/v1/messages/count_tokens \
-H "Authorization: Bearer $LM0_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}'