Anthropic-Compatible API
Anthropic Messages API, fully compatible with Claude Code and the Anthropic SDK
TokenLink provides an Anthropic Messages API-compatible endpoint that Claude Code and all Anthropic SDK tools can use directly.
Base endpoint
GET /anthropicConnectivity check.
curl https://tokenlink.stelarx.ai/anthropic
# {"status": "ok"}Create a message
POST /anthropic/v1/messagesThe standard path for the Anthropic Messages API.
Request example
curl https://tokenlink.stelarx.ai/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Explain generics in TypeScript"}
]
}'With a system prompt
curl https://tokenlink.stelarx.ai/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"system": "You are a TypeScript expert; keep answers concise.",
"messages": [
{"role": "user", "content": "How do I use generic constraints?"}
]
}'Extended thinking
curl https://tokenlink.stelarx.ai/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"model": "claude-opus-4-8",
"max_tokens": 4096,
"thinking": {
"type": "enabled",
"budget_tokens": 1024
},
"messages": [
{"role": "user", "content": "Design an architecture for a distributed system"}
]
}'Streaming output
curl https://tokenlink.stelarx.ai/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"stream": true,
"messages": [
{"role": "user", "content": "Write a quicksort implementation in TypeScript"}
]
}'Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | Model ID |
max_tokens | integer | ✅ | Maximum output tokens |
messages | array | ✅ | List of messages (alternating user/assistant) |
system | string/array | System prompt | |
temperature | number | Sampling temperature (0-1) | |
stream | boolean | Whether to use SSE streaming output | |
thinking | object | Extended thinking configuration | |
tools | array | Tool definitions | |
tool_choice | any | Tool selection strategy | |
stop_sequences | array | Custom stop sequences |
Response
{
"id": "msg_xxx",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-5",
"content": [{
"type": "text",
"text": "Generics in TypeScript are..."
}],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 25,
"output_tokens": 180,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0
}
}List models (Anthropic format)
GET /anthropic/v1/modelsReturns a model list in Anthropic format, used for Claude Code's model discovery.
curl https://tokenlink.stelarx.ai/anthropic/v1/models \
-H "x-api-key: YOUR_API_KEY"Protocol adaptation note: non-Claude models (such as Gemini or DeepSeek) are given a
claude-prefix so they pass Claude Code's client-side filter. See Protocol Adaptation for details.