UniterRouter
API ReferenceAnthropic API

Anthropic API

Claude API integration - Access Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku through UniterRouter. Native Anthropic SDK support with tool use and vision capabilities.

Anthropic API

Access Claude models through UniterRouter with full Anthropic API compatibility. Supports both native Anthropic SDK and OpenAI-compatible format.

Two API Formats: UniterRouter supports both the native Anthropic Messages API (/v1/messages) and OpenAI-compatible Chat Completions API (/v1/chat/completions). Choose based on your SDK preference.

Quick Start

import anthropic

client = anthropic.Anthropic(
    api_key="your_uniterouter_api_key",
    base_url="https://api.uniterouter.ai"
)

message = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)
print(message.content[0].text)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.uniterouter.ai/v1",
    api_key="your_uniterouter_api_key",
)

response = client.chat.completions.create(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
curl https://api.uniterouter.ai/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: $UNITEROUTER_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Available Claude Models

ModelDescriptionContextMax Output
claude-sonnet-4-20250514Latest Claude 4 Sonnet200K64K
claude-opus-4-20250514Most powerful Claude 4200K32K
claude-3-7-sonnet-20250219Claude 3.7 Sonnet with extended thinking200K128K
claude-3-5-sonnet-20241022Claude 3.5 Sonnet200K8K
claude-3-5-haiku-20241022Fast and affordable200K8K
claude-3-opus-20240229Claude 3 Opus200K4K
claude-3-haiku-20240307Previous Haiku200K4K

Features

All Claude features are supported:

  • Streaming: Real-time response streaming
  • Vision: Image input with base64 or URL
  • Tool Use: Function calling with structured outputs
  • Extended Thinking: Deep reasoning with Claude 3.7+
  • System Prompts: Via system message or parameter
  • PDF Support: Document analysis (Claude 3.5+)

SDK Installation

pip install anthropic
pip install openai

API Endpoints

EndpointFormatDescription
POST /v1/messagesAnthropic nativeMessages API
POST /v1/chat/completionsOpenAI compatibleChat Completions

How is this guide?