claude-opus-5
Claude Opus 5 — Anthropic's model for complex agentic coding and enterprise work. OpenAI-compatible /v1/chat/completions on api.reapi.ai with a 1M-token context window, 128k max output, adaptive thinking on by default, and a five-level effort dial.
Anthropic's Claude Opus 5 — "for complex agentic coding and enterprise work" —
exposed through api.reapi.ai as a drop-in OpenAI-compatible Chat Completions
endpoint. A 1M-token context window, 128k max output, adaptive
thinking on by default, an effort dial from low through max, plus tool
use, structured outputs, code execution, vision and PDF input. The wire model
id is claude-opus-5 — Anthropic's alias carries no date suffix. Current rates
live on the model page and on
api.reapi.ai/pricing.
Quick example
curl https://api.reapi.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-5",
"messages": [
{ "role": "user", "content": "Refactor this module and add tests." }
],
"stream": true,
"max_tokens": 16000
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.reapi.ai/v1",
)
stream = client.chat.completions.create(
model="claude-opus-5",
messages=[{"role": "user", "content": "Refactor this module and add tests."}],
max_tokens=16000,
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="")import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.reapi.ai/v1",
});
const stream = await client.chat.completions.create({
model: "claude-opus-5",
messages: [{ role: "user", content: "Refactor this module and add tests." }],
max_tokens: 16000,
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "claude-opus-5",
"messages": []map[string]string{
{"role": "user", "content": "Refactor this module and add tests."},
},
"max_tokens": 16000,
})
req, _ := http.NewRequest("POST",
"https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}Authentication
Chat models are served from the api.reapi.ai gateway, which has its own console
and its own key. Create the key there, then send it as a bearer token:
Authorization: Bearer YOUR_API_KEYThe gateway key is not the same credential as a media-generation key used
against reapi.ai/api/v1. Sign in at
api.reapi.ai to create one.
Endpoint
POST /v1/chat/completionsBase URL https://api.reapi.ai. The wire format is OpenAI-compatible, so the
same SDKs (openai-python, openai-node, openai-go, …) work once you swap the
base URL, the key and the model string.
Request body
model — string, required
Must be claude-opus-5 exactly. Anthropic's alias carries no date suffix, so
there is nothing to append.
messages — array, required
Conversation history, each entry an object with role and content. Roles are
system, user and assistant. Text, image and PDF parts are supported — see
Multimodal input.
max_tokens — integer
Upper bound on output tokens for this response, thinking tokens included. Anthropic documents a 128k-token output ceiling for this model.
Thinking is on by default on this model, and max_tokens caps thinking plus
response text together. A budget carried over from a model that ran without
thinking can truncate mid-answer. Raise it, or turn thinking off — subject to the
effort cap below.
stream — boolean, default false
When true, tokens arrive as server-sent events terminated by data: [DONE].
Recommended for anything a person watches, and effectively required for large
max_tokens values — a non-streamed request with a big budget can hit an HTTP
timeout.
thinking — object, optional
Omit it and the model runs adaptive thinking. See Thinking for the two rules that differ from the previous Opus generation.
output_config — object, optional
Carries effort and the structured-output format. See Effort.
tools / tool_choice — optional
Tool definitions and the strategy for picking among them.
group — string, default "default"
Token group on the gateway. Leave it at default unless your account has been
given another group to route through.
Thinking
Two things differ from the previous Opus generation, and both bite code that was carried straight over.
1. Thinking runs when you omit the parameter. On the previous generation,
omitting thinking meant no thinking. Here it runs adaptive. That is a silent
cost and truncation change on any route that never set the field.
2. Turning thinking off is capped at high effort. thinking disabled is
accepted only at effort high or lower; pairing it with xhigh or max is
rejected. The check runs per request, so a later call that raises effort while
thinking is still disabled fails even though earlier calls in the same
conversation succeeded.
The raw chain of thought is never returned on this model. The default is omitted; ask for a summary if you surface reasoning to users. Fixed thinking-token budgets are not accepted.
Given how well this model performs at low and medium effort, a
latency-sensitive route is usually better served by lowering effort than by
disabling thinking.
Effort
output_config.effort takes five levels — low, medium, high, xhigh,
max — and defaults to high on the Claude API.
| Level | Use it for |
|---|---|
max | The hardest reasoning, where correctness outweighs cost. Can overthink routine work. |
xhigh | Coding and agentic workloads — the recommended starting point for those. |
high | The default; intelligence-sensitive work generally. |
medium | A cost step-down that holds up unusually well on this model. |
low | Short, scoped, latency-sensitive tasks. |
Effort is the primary cost and latency lever here — start at xhigh for
coding/agentic work and high elsewhere, then sweep downward against your own
evals. Defaults carried over from an older model rarely transfer.
At xhigh or max, set a large max_tokens so there is room to think and act
across tool calls.
Parameters that are no longer accepted
These are rejected on this generation. Remove them rather than working around them:
| Parameter | Do this instead |
|---|---|
temperature, top_p, top_k | Steer with prompting and the effort level |
| Fixed thinking-token budget | Use effort |
| Last-assistant-turn prefill | Use structured outputs, or a system-prompt instruction |
Multimodal input
| Modality | Supported |
|---|---|
| Text | ✅ |
| Image | ✅ |
| ✅ |
Output is text only. Vision is strong on charts, diagrams and dense documents — and on this model, giving it tools to crop and re-examine an image is a more cost-effective lever than raising thinking depth alone.
Pricing dimensions
Billing is per token, in USD, against your api.reapi.ai balance, with
separate input and output rates. Three things to keep in mind:
- Thinking tokens bill as output. Since thinking is on by default here, that is the usual reason a bill exceeds an estimate built from visible response length alone.
- Output dominates. For most generative workloads the output rate decides the invoice.
- Effort moves the bill. It changes how much the model thinks and how many tool calls it makes, so it is the lever to tune before anything else.
Both token rates sit at less than half Anthropic's published per-token rate. Current numbers are on the model page and api.reapi.ai/pricing — those tables are the canonical source, not this page.
Chat models bill in USD on the gateway balance. They do not draw down the
integer credits used by the media-generation endpoints on reapi.ai/api/v1.
Response shape
Non-streaming (stream: false)
{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1785000000,
"model": "claude-opus-5",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "..." },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1204,
"completion_tokens": 860,
"total_tokens": 2064
}
}usage.completion_tokens includes thinking tokens, so it is the number to
reconcile a bill against.
Streaming (stream: true)
Server-sent events, each data: line carrying a chat.completion.chunk with the
incremental text in choices[0].delta.content, terminated by data: [DONE].
Errors
Failures use the gateway's standard envelope. See the errors catalog for the full code list. Common cases:
| Trigger | What to do |
|---|---|
| Missing or invalid bearer token | Create a key in the api.reapi.ai console |
Unknown model value | Send claude-opus-5 exactly — no date suffix |
temperature / top_p / top_k present | Remove them; they are not accepted on this generation |
Thinking disabled at xhigh / max effort | Lower effort to high, or leave thinking on |
max_tokens above the model ceiling | Lower it; the documented ceiling is 128k |
| Insufficient balance | Top up on the gateway |
| Upstream rate limit | Retry with backoff, or route through another model |
Anthropic runs elevated safety classifiers on this generation. A declined request can come back as a successful response whose stop reason is a refusal, with an empty or partial body rather than an error. Check the stop reason before reading the content — code that indexes the first content block unconditionally will break on a refusal.
Tips
- Give the whole task up front. This model is built for long-horizon autonomous work; a complete specification in one turn outperforms revealing the task across many short interactive turns.
- Stream anything interactive, and stream anything with a large
max_tokens. - Budget for thinking. If responses truncate mid-sentence on hard prompts, the
reasoning pass consumed the allowance — raise
max_tokens. - Sweep effort, don't inherit it.
lowandmediumare unusually strong here; the right level is workload-specific. - Delete "double-check your work" instructions. This model verifies its own output without being told, and telling it to verify causes redundant work.
- Ask for coverage in code review, then filter. Instructions like "only report high-severity issues" are followed literally, which depresses measured recall. Have it report everything with confidence and severity, and filter in a separate pass.
- Short prompts cache now. The minimum cacheable prefix is 512 tokens, half the previous generation's floor — prompts you had written off as uncacheable may qualify.
Related
- Claude Opus 5 model page — current rates
- Claude Opus 4.8 — the previous generation
- Errors catalog
- Authentication
- Quickstart