Skip to content

Claude native (Anthropic Messages)

POST https://gateway.mindproxy.ai/v1/messages
POST https://gateway.mindproxy.ai/anthropic/v1/messages

Compatible with the Anthropic Messages API; use the official Anthropic SDK with base_url pointed at the platform.

Authentication

Accepts x-api-key: sk-..., or Authorization: Bearer sk-.... Sending an anthropic-version header is recommended.

Request

bash
curl https://gateway.mindproxy.ai/v1/messages \
  -H "x-api-key: $TT_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Introduce Shanghai in one sentence."}
    ]
  }'
FieldDescription
modelPublic model ID (e.g. claude-3-5-sonnet)
max_tokensRequired, max output tokens
messagesConversation messages
systemSystem prompt (top-level field, not a message)
streamtrue enables streaming

Response

json
{
  "id": "msg_...",
  "type": "message",
  "role": "assistant",
  "model": "claude-3-5-sonnet",
  "content": [{"type": "text", "text": "Shanghai is China's economic and financial center."}],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 18, "output_tokens": 12}
}

usage is the billing basis.

Token counting (free)

POST https://gateway.mindproxy.ai/v1/messages/count_tokens

Estimates input token count; it is not billed.

SDK

See Python · Claude and Node.js · Claude. Set the Anthropic SDK base_url to https://gateway.mindproxy.ai; the SDK appends /v1/messages.

Gateway: gateway.mindproxy.ai · Built with VitePress