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 /anthropic

Connectivity check.

curl https://tokenlink.stelarx.ai/anthropic
# {"status": "ok"}

Create a message

POST /anthropic/v1/messages

The 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

ParameterTypeRequiredDescription
modelstringModel ID
max_tokensintegerMaximum output tokens
messagesarrayList of messages (alternating user/assistant)
systemstring/arraySystem prompt
temperaturenumberSampling temperature (0-1)
streambooleanWhether to use SSE streaming output
thinkingobjectExtended thinking configuration
toolsarrayTool definitions
tool_choiceanyTool selection strategy
stop_sequencesarrayCustom 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/models

Returns 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.