Anthropic Messages
Requests and streaming events identical to the Anthropic Messages API; works directly with Claude Code and the official SDKs.
Endpoint
POST/anthropic/v1/messages
| Field | Type | Description | |
|---|---|---|---|
| model | string | required | Model name. |
| max_tokens | integer | required | Output cap. |
| messages | array | required | user / assistant turns; content supports text, images and tool_result. |
| system | string | array | optional | System prompt, supports cache_control. |
| tools / tool_choice | array / object | optional | Tool definitions and policy. |
| thinking | object | optional | Extended thinking configuration (where the model supports it). |
| stream | boolean | optional | SSE events: message_start → content_block_delta … → message_delta (with usage) → message_stop. |
| metadata.user_id | string | optional | End-user identifier for risk control and usage attribution. |
export ANTHROPIC_BASE_URL=https://www.link42.ai/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-...
claudecurl https://www.link42.ai/anthropic/v1/messages \
-H "x-api-key: $LINK42_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Explain idempotency keys in two sentences."}]
}'- The older /v1/messages path still works. The /anthropic Base URL is easier to configure in native Claude clients.
Token counting
POST/anthropic/v1/messages/count_tokens
Returns {input_tokens}. Estimated locally, free of charge.