models/Anthropic/Claude Opus 4.8
Anthropic

Claude Opus 4.8

text
Playground →Compare

Claude Opus 4.8 is Anthropic's most capable generally available model, with a step-change improvement in agentic coding over Claude Opus 4.7. It uses adaptive thinking to calibrate reasoning per task and supports a one million token context window at standard pricing.

MODALITIES
text + vision
INPUT
$5.00 /1M
OUTPUT
$25.00 /1M
CONTEXT
1M tok
MAX OUTPUT
128K tok
USAGE
39.9B
0.3% market share
RELEASED
2026-05-28

Claude Opus 4.8 (anthropic/claude-opus-4.8) is a text model from Anthropic, released 2026-05-28. Context window: 1,000,000 tokens; max output 128,000. Pricing via AIgateway: input $5.00/M tokens, output $25.00/M tokens, cache $0.500/M. Capabilities: tools, streaming, vision, json, caching, reasoning, batch. Call it via https://api.aigateway.sh/v1/chat/completions with the OpenAI SDK — set model="anthropic/claude-opus-4.8". Best for: Autonomous coding agents, Codebase-scale migrations, Computer use / browser agents, High-stakes reasoning + analysis, Long-document work (1M context).

model · anthropic/claude-opus-4.8family · Claude 4

Use this model

model: anthropic/claude-opus-4.8
curl https://api.aigateway.sh/v1/chat/completions \
  -H "Authorization: Bearer $AIGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/claude-opus-4.8","messages":[{"role":"user","content":"hello"}],"stream":true}'

Capabilities

Tool callingStreamingVisionJSON modeCachingReasoningBatch
CONTEXT
1,000,000 tok
MAX OUTPUT
128,000 tok

Strengths

  • Anthropic's most capable model — #1 on the Artificial Analysis Intelligence Index
  • Best computer-use / browser agent tested (84% on Online-Mind2Web)
  • Adaptive thinking — calibrates reasoning depth per task
  • ~4× less likely than Opus 4.7 to let code flaws pass unremarked
  • More efficient tool calling — fewer steps for the same result

Use cases

Autonomous coding agentsCodebase-scale migrationsComputer use / browser agentsHigh-stakes reasoning + analysisLong-document work (1M context)

Benchmarks

AA Intelligence Index61
Online-Mind2Web (computer use)84
Source: Artificial Analysis · Anthropic · 2026-05-28

Adoption

39.9B tokens
644.2K requests · 0.3% of tracked market volume
See the full leaderboard →
Aggregate usage across the open model ecosystem (as of 2026-05-22).

Pricing

Input$5.00 / 1M tokens
Output$25.00 / 1M tokens
Cache read$0.500 / 1M tokens
Cache write$6.25 / 1M tokens
Same price as Opus 4.7. Fast mode available at $10/$50 in/out.
You pay pass-through · 5% applied at credit top-up, not per-call.
Try in playground →CompareAPI referenceSee usage ranking →

Collections

More text models →More from AnthropicFrontier models →Free-tier models →
API schema

Call Claude Opus 4.8 from any OpenAI SDK

POST https://api.aigateway.sh/v1/chat/completions·Content-Type: application/json·Auth: Bearer sk-aig-...

Request body

json
{
  "model": "anthropic/claude-opus-4.8",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user",   "content": "Hello!" }
  ],
  "temperature": 0.7,
  "top_p": 0.95,
  "max_tokens": 1024,
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "parameters": {
          "type": "object",
          "properties": {
            "city": { "type": "string" }
          },
          "required": ["city"]
        }
      }
    }
  ],
  "tool_choice": "auto",
  "parallel_tool_calls": true,
  "response_format": { "type": "json_object" }

  // For vision: messages[].content can be an array of
  //   { type: "text", text: "..." }  and
  //   { type: "image_url", image_url: { url: "https://..." } }
}

Response

json
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1776947082,
  "model": "anthropic/claude-opus-4.8",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?",
        "tool_calls": [
          {
            "id": "call_abc123",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"city\":\"Tokyo\"}"
            }
          }
        ]
      },
      "finish_reason": "stop"   // or "tool_calls" when calling a function
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 12,
    "total_tokens": 36
  }
}

Streaming (SSE) — set "stream": true

// 1. Role announcement (first chunk):
data: {"choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

// 2. Content chunks (final answer):
data: {"choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}
data: {"choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}

// Tool-call chunks (when the assistant calls a function):
data: {"choices":[{"index":0,"delta":{"tool_calls":[
  {"index":0,"id":"call_abc","type":"function",
   "function":{"name":"get_weather","arguments":""}}]},"finish_reason":null}]}
data: {"choices":[{"index":0,"delta":{"tool_calls":[
  {"index":0,"function":{"arguments":"{\"city\":"}}]},"finish_reason":null}]}
data: {"choices":[{"index":0,"delta":{"tool_calls":[
  {"index":0,"function":{"arguments":"\"Tokyo\"}"}}]},"finish_reason":null}]}
// Concat arguments fragments by index → {"city":"Tokyo"}

// Finish chunk:
data: {"choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

// Terminator:
data: [DONE]

Quickstart

# pip install aigateway-py openai
# aigateway-py adds sub-accounts, evals, replays, jobs, webhook verify.
# openai SDK covers chat — drop-in per our SDK's own guidance.
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aigateway.sh/v1",
    api_key="sk-aig-...",
)

stream = client.chat.completions.create(
    model="anthropic/claude-opus-4.8",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)

Errors

401authentication_errorInvalid or missing API key
402insufficient_creditsWallet empty (PAYG only)
404not_foundUnknown model or endpoint
429rate_limit_errorOver per-minute limit — see Retry-After header
500server_errorUpstream provider failed (retryable)
503service_unavailableUpstream saturated (retryable)
Full docs →API reference →OpenAPI spec →llms.txt →

Frequently asked questions

What is Claude Opus 4.8?
Claude Opus 4.8 is Anthropic's most capable generally available model, with a step-change improvement in agentic coding over Claude Opus 4.7. It uses adaptive thinking to calibrate reasoning per task and supports a one million token context window at standard pricing. It is a text model from Anthropic, accessible via AIgateway's OpenAI-compatible API at slug anthropic/claude-opus-4.8.
How much does Claude Opus 4.8 cost via AIgateway?
Input costs $5.00 per 1M tokens; output costs $25.00 per 1M tokens. Pass-through plus a 5% platform fee applied at top-up, not per call.
What is the context window of Claude Opus 4.8?
1,000,000 tokens. Maximum output is 128,000 tokens.
How do I call Claude Opus 4.8 from my code?
Point the OpenAI SDK at https://api.aigateway.sh/v1 with your AIgateway key and set model to "anthropic/claude-opus-4.8". The request and response shapes match OpenAI exactly.
Does Claude Opus 4.8 support streaming, tool calling, vision, and JSON mode?
Streaming — yes. Tool calling — yes. Vision — yes. JSON mode — yes. Prompt caching — yes.
What are the best use cases for Claude Opus 4.8?
Autonomous coding agents, Codebase-scale migrations, Computer use / browser agents, High-stakes reasoning + analysis, Long-document work (1M context). Key strengths: Anthropic's most capable model — #1 on the Artificial Analysis Intelligence Index; Best computer-use / browser agent tested (84% on Online-Mind2Web); Adaptive thinking — calibrates reasoning depth per task.
Can I bring my own Anthropic API key (BYOK)?
Yes. Attach a Anthropic key in your AIgateway dashboard and this model flips to pass-through — you pay Anthropic directly and AIgateway waives the 5% platform fee on those calls.