English
Guides
Claude Models in OpenCode

Running Claude 5 Models in OpenCode

Short version: Claude Opus 5 is the one to reach for. Anthropic shipped it on July 24, 2026 at half of Fable 5's token price while landing close to Fable 5 on coding work — over a long agentic run, that tradeoff usually favors Opus 5. Reach for Fable 5 when you want the ceiling and cost is secondary.

Anthropic's naming is genuinely confusing here, which is worth getting straight. The Claude 5 generation arrived as Fable 5 (June 9) and Sonnet 5 (late June), with Fable 5 as the Mythos-class flagship sitting above the Opus tier. Opus 5 then landed on July 24 as the fourth model in under two months — so "Opus 5" is not the top of the lineup, but it is the value sweet spot.

The current Claude lineup

ModelWhere it fits in OpenCodeAPI price (in / out per Mtok)
Claude Opus 5The default pick. Long agentic runs, complex coding$5 / $25
Claude Fable 5Maximum capability when cost is secondary$10 / $50
Claude Sonnet 5Fast everyday coding$3 / $15
Claude Haiku 4.5Cheap and fast — routine edits, bulk work
⚠️

Model IDs are exact strings and vary by provider — routing through an aggregator often means a different ID than Anthropic's native one. Check your provider's model list (or run /models in OpenCode) rather than guessing, and do not append date suffixes unless the provider documents them.

Setup: any of these models in three steps

The mechanics are identical whichever model you pick, because OpenCode treats them all as provider entries.

1. Get access. Either an Anthropic API key, or a single aggregated API platform that serves all of them behind one OpenAI-compatible endpoint at a discount.

2. Declare the models in opencode.json:

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "my-api-platform": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "My API Platform",
      "options": {
        "baseURL": "<your-platform-baseURL>"
      },
      "models": {
        "<opus-5-id-from-your-provider>": { "name": "Claude Opus 5" },
        "<fable-5-id-from-your-provider>": { "name": "Claude Fable 5" },
        "<sonnet-5-id-from-your-provider>": { "name": "Claude Sonnet 5" }
      }
    }
  }
}

3. Pick one per task. Start opencode, run /models, and switch whenever the work changes shape. Full options are in the configuration reference.

/models

Claude Opus 5

Released July 24, 2026, and the model most OpenCode users should default to. Anthropic's own framing is that it "comes close to the capabilities of Claude Fable 5 in many domains" while being meaningfully better at complex coding tasks — at $5/$25 per million tokens, half of Fable 5 and the same rate as the Opus 4.8 it replaces.

The economics are what make it the default rather than the benchmarks. Agentic runs burn tokens: an unattended agent workflow working through a multi-file change can spend far more than an interactive session. Halving the rate while staying near flagship quality compounds over a long run in a way a small benchmark gap does not. Pair it with permissions so an autonomous run cannot do anything you did not sanction.

It is also the default model on Claude Max and the strongest model available on Claude Pro, so subscription users get it at no extra cost.

What changed with Opus 5

Opus 5 is the fourth model Anthropic shipped in under two months — Fable 5 on June 9, Sonnet 5 in late June, then Opus 5 on July 24. The pattern matters if you are configuring OpenCode: the lineup is moving fast enough that pinning one model in opencode.json and forgetting about it will leave you on stale defaults.

What is actually new, versus the Opus 4.8 it replaces:

  • Same price, more capability. $5/$25 per million tokens, unchanged from 4.8. Anthropic describes it as more efficient rather than more expensive, which is unusual for a generational bump
  • Closes most of the gap to Fable 5. Anthropic's wording is "comes close to the capabilities of Claude Fable 5 in many domains," and it tops Fable 5 on several coding benchmarks despite being the smaller model
  • Less restrictive than Fable 5 in practice, which matters for agentic runs that would otherwise stall on refusals mid-task
  • Full 1M context with no premium, so long-context work does not carry a surcharge

When Opus 5 is the wrong pick

Worth being direct about the limits, since "new default" does not mean "always":

  • You need the absolute ceiling. On the hardest problems Fable 5 still wins. If a task has already defeated Opus 5 twice, escalating beats retrying
  • Latency dominates. For fast interactive edits where you are watching each diff, Sonnet 5 returns quicker at a third of the input cost
  • The work is mechanical. Renames, formatting sweeps, boilerplate — Haiku 4.5 does these fine and Opus 5 is wasted spend

Running Opus 5 in OpenCode

Nothing about the setup is Opus-specific: declare it as a model under any OpenAI-compatible provider, then select it with /models. Two things worth doing once it is configured:

  1. Make it the session default rather than switching to it manually, since it is the right pick for most tasks. Set it in opencode.json under your provider's model list
  2. Keep Fable 5 configured alongside it so escalation is one /models call away rather than a config edit mid-task

If you route through an aggregated platform, Opus 5's discount stacks with the platform's — the same $5/$25 official rate lands lower, which is the case where the cost argument for Opus 5 over Fable 5 gets strongest.

Claude Fable 5

Still the ceiling. Thinking is always on, so it plans before it edits, and on the hardest work — sprawling refactors, debugging that has already defeated two other models — it remains the one to escalate to.

At $10/$50 it is double Opus 5. That gap is the whole argument for not running it as your default: reach for it when a task has actually stalled, not preemptively.

There is a dedicated Fable 5 setup guide with the full walkthrough.

There is a dedicated Fable 5 setup guide with the full walkthrough.

Claude Sonnet 5

Fast and cheap for interactive work. At $3/$15 it undercuts Opus 5, but the gap is only 1.67x — small enough that for anything agentic, Opus 5's extra capability is usually worth it. Sonnet 5 earns its place on quick edits where you are watching the output and latency matters more than depth.

Claude Haiku 4.5

Cheapest and fastest. Worth configuring alongside the others for mechanical work — renames, formatting sweeps, boilerplate — where model intelligence is not the bottleneck. Note it has a smaller context window than the Claude 5 models.


Picking without overthinking it

  • Just want one model configured? Opus 5.
  • Cost is not a constraint and the task is hard? Fable 5.
  • Quick interactive edits, latency matters? Sonnet 5.
  • Bulk mechanical edits? Haiku 4.5.

Because OpenCode is provider-agnostic, none of this is a lock-in decision. You can configure all four and switch per task, which is the main practical advantage over tools tied to a single vendor — see OpenCode vs Claude Code for how that comparison plays out.

Why route through one platform

Running Claude models directly means an Anthropic account and bill. Mixing in GPT or Gemini for A/B comparison means another. An aggregated platform gives you every model above through one key and one endpoint — and the platform we recommend does it at up to 90% below official prices, with instant registration.

FAQ

Q: Is there a Claude Opus 5?

A: Yes — Anthropic released it on July 24, 2026. It is priced at $5/$25 per million tokens, half of Fable 5, and Anthropic says it comes close to Fable 5 in many domains while being better at complex coding. It is the default model on Claude Max and the strongest model on Claude Pro. Note that Fable 5, not Opus 5, sits at the top of the lineup — Anthropic put the Mythos-class Fable above the Opus tier.

Q: Which Claude model is best for OpenCode?

A: Opus 5 for most work, especially agentic runs where token cost compounds. Fable 5 when a task has stalled and you want the ceiling. Sonnet 5 for fast interactive edits. Switch between them with /models — you do not have to commit.

Q: How do I use Claude 5 models in OpenCode?

A: Add an OpenAI-compatible provider to opencode.json, list the models your provider exposes, then run /models. Model ID strings differ between Anthropic's native API and aggregators, so take them from your provider's model list. Details in the providers guide.

Q: Can I run Claude models alongside GPT and Gemini?

A: Yes. OpenCode supports 75+ providers, so you can keep several families configured at once and A/B the same prompt across them — useful when one model is stuck on something another cracks.