Anthropic Messages

Use the native Anthropic Messages request, tool-use, and streaming shapes with a scoped OurToken API key.

Endpoint and headers

POST /v1/messages

Authenticate using the standard Anthropic headers:

x-api-key: $OURTOKEN_API_KEY
anthropic-version: 2023-06-01
curl https://api.ourtoken.dev/v1/messages \
  -H "x-api-key: $OURTOKEN_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "max_tokens": 300,
    "messages": [{"role": "user", "content": "Summarize this diff."}]
  }'

Responses use the Anthropic message object, content blocks, and input_tokens/output_tokens usage fields.

Tool use and streaming

Function definitions use input_schema. The model returns tool_use content blocks; send their results back in a user tool_result block with the matching tool_use_id.

Set stream: true to receive standard Messages SSE events: message_start, content_block_start, content_block_delta, message_delta, and message_stop. Text and incremental tool JSON are emitted in their native Anthropic event shapes.

Supported subset

The initial surface supports text content, a top-level system instruction, function tools, tool results, streaming, terminal usage, and the standard non-billable POST /v1/messages/count_tokens response shape. Token counting uses the normalized request structure without reserving wallet credit or invoking a model. It intentionally does not accept beta headers/features, non-text media blocks, or prompt caching.

Coding-tool validation

Use a client that permits a custom Anthropic-compatible base URL, then test its exact version against a staging key and active model. Different clients can request beta features or auxiliary endpoints that are outside this initial subset.