Anthropic-Compatible API

Invoke Claude and cross-model foundation weights via the native Anthropic Messages wire format at https://api.toknix.in.

Toknix provides native support for Anthropic's Messages API. You can configure any tool built for Claude (such as Claude Code CLI) directly to Toknix without modifying request syntax.

Messages Endpoint

Endpoint: POST https://api.toknix.in/v1/messages

bash
curl https://api.toknix.in/v1/messages   -H "x-api-key: $TOKNIX_API_KEY"   -H "anthropic-version: 2023-06-01"   -H "Content-Type: application/json"   -d '{
    "model": "claude-opus-5-5",
    "max_tokens": 1024,
    "system": "You are a concise cybersecurity analyst.",
    "messages": [
      {"role": "user", "content": "Analyze the security of ephemeral tokenized PINs."}
    ]
  }'

Request Headers

  • x-api-key: Your Toknix secret API key (or use Authorization: Bearer tk_live_...).
  • anthropic-version: Set to 2023-06-01.
  • anthropic-beta: Optional beta flags (e.g., prompt-caching-2024-07-31).

Extended Thinking

Models that support chain-of-thought synthesis accept the Anthropic thinking configuration block:

json
{
  "model": "claude-opus-5-5-max",
  "max_tokens": 8192,
  "thinking": {
    "type": "enabled",
    "budget_tokens": 2048
  },
  "messages": [
    {"role": "user", "content": "Prove that the square root of 2 is irrational."}
  ]
}

Cross-Model Compatibility

One of Toknix's most powerful architectural features is universal protocol virtualization. You can call non-Anthropic models (such as DeepSeek, GLM, GPT, or Grok) using the Anthropic Messages wire format:

bash
curl https://api.toknix.in/v1/messages   -H "x-api-key: $TOKNIX_API_KEY"   -H "anthropic-version: 2023-06-01"   -H "Content-Type: application/json"   -d '{
    "model": "deepseek-v4.1-flash",
    "max_tokens": 512,
    "messages": [
      {"role": "user", "content": "Say hello from DeepSeek via Anthropic protocol!"}
    ]
  }'

Token Counting Endpoint

Endpoint: POST https://api.toknix.in/v1/messages/count_tokens

Inspect the exact token weight of complex system prompts, few-shot message histories, or tool specifications before executing inference.