Skip to main content
OpenPAI integrates Anthropic Claude over two protocols at once: OpenAI-compatible and the Claude-native /v1/messages.

Available models

Model IDContextMax outputPositioning
claude-opus-4-81M128KLatest top tier — strongest at complex reasoning and long-horizon agentic coding
claude-sonnet-4-61M64KBest balance of speed and intelligence — recommended for code / reasoning / agents
claude-haiku-4-5200K64KFastest, near-frontier intelligence — first choice for everyday chat and code

Legacy (still available)

Model IDContextNotes
claude-opus-4-71MPrevious-gen top tier
claude-opus-4-5200KOlder flagship
claude-sonnet-4-5200KPrevious-gen Sonnet
claude-3-7-sonnet-20250219200KInterim version
claude-3-5-sonnet-20241022200KOlder, for compatibility

Thinking

Claude can reason internally before the final answer. There are two approaches across generations:
  • Extended Thinking: claude-sonnet-4-6 and claude-haiku-4-5 set a budget_tokens thinking budget via the thinking parameter.
  • Adaptive Thinking: claude-opus-4-8 and claude-opus-4-7 are controlled by the effort parameter (low / medium / high); Opus 4.8 defaults to high and no longer uses budget_tokens.

Enable extended thinking via model ID

Model IDBehavior
claude-sonnet-4-6-thinkingSonnet 4.6, thinking enabled automatically
claude-haiku-4-5-thinkingHaiku 4.5, thinking enabled automatically

Enable via parameter (Claude native protocol)

# Extended thinking: Sonnet 4.6 / Haiku 4.5
curl https://openp.ai/v1/messages \
  -H "x-api-key: $OPENPAI_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 4096,
    "thinking": { "type": "enabled", "budget_tokens": 8000 },
    "messages": [{"role": "user", "content": "Prove Goldbach's conjecture"}]
  }'
# Adaptive thinking: Opus 4.8 (effort defaults to high)
curl https://openp.ai/v1/messages \
  -H "x-api-key: $OPENPAI_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4-8",
    "max_tokens": 4096,
    "effort": "high",
    "messages": [{"role": "user", "content": "Prove Goldbach's conjecture"}]
  }'
Tokens produced by thinking and tokens in the final answer are billed separately (thinking_tokens vs. output_tokens), shown distinctly in the console log. Exact parameter support is subject to the console.

Examples

OpenAI-compatible protocol

from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://openp.ai/v1")

resp = client.chat.completions.create(
    model="claude-opus-4-8",
    messages=[
        {"role": "system", "content": "You are a senior Go engineer."},
        {"role": "user", "content": "Implement a consistent-hashing ring in Go."},
    ],
)

Claude native SDK

from anthropic import Anthropic

client = Anthropic(
    api_key="sk-XXXXXXXXXXXXXXXX",
    base_url="https://openp.ai",
)

resp = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=2048,
    system="You are a senior Go engineer.",
    messages=[{"role": "user", "content": "Implement a consistent-hashing ring in Go."}],
)
print(resp.content[0].text)

Tool calling

Claude natively supports the three-step tools / tool_use / tool_result tool-calling flow, fully compatible with the official Anthropic protocol. When accessed via the OpenAI-compatible endpoint, tool calls are automatically converted to OpenAI’s tools / tool_calls structures. See Function calling.

Vision

Supports image URL and base64 input:
{
  "model": "claude-opus-4-8",
  "messages": [
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What's in the image?"},
        {"type": "image_url", "image_url": {"url": "https://example.com/x.png"}}
      ]
    }
  ]
}

Prompt caching

Claude supports marking long context segments with cache_control to hit the prompt cache, with cache hits billed at a lower rate. OpenPAI passes this field through verbatim — see Cache billing.

Other capabilities

Anthropic also offers Message Batches (asynchronous, ~50% off), the Files API, 1M long context, citations, and memory. Whether these are exposed through the OpenPAI gateway is subject to the console / site announcements.

API docs