examples/anthropic/opus-4-8-coding/README.md
This example exercises the Opus-tier Claude models on hard coding tasks, comparing Claude Opus 5 against Claude Opus 4.8 at xhigh effort — plus Opus 5 at low so you can see the effort tradeoff on your own tasks.
You can run this example with:
npx promptfoo@latest init --example anthropic/opus-4-8-coding
cd opus-4-8-coding
Opus 5 is the current Opus-tier model, at the same $5/$25 pricing as Opus 4.8 — so this is a like-for-like capability comparison rather than a cost one. This example evaluates:
thinking block runs adaptive thinking rather than none. Since max_tokens caps thinking plus the answer, give it headroom — promptfoo's default rises to 2048 on this model, but set it explicitly for real work. On the bug-diagnosis task in this example, Opus 5 at xhigh spent ~4.4k tokens thinking; an 8k budget truncated the answer mid-sentence, which is why this config uses 16k.thinking: { type: disabled } is only accepted at effort high or below; pairing it with xhigh or max returns a 400. Promptfoo drops the rejected disabled (keeping your effort) and warns once.effort is the main cost lever. Opus 5 supports low through max. Start at xhigh for coding and agentic work, then sweep downward — low and medium are unusually strong here, which is why this example runs both.temperature, top_p, and top_k at the model level; promptfoo omits them automatically (don't set them in config).thinking block Opus 4.8 runs without extended thinking, even at high effort — so this example sets thinking: { type: adaptive } on the 4.8 provider.effort defaults to high; xhigh is available. Setting effort: high behaves the same as omitting it. Start with xhigh for coding and agentic work, and pair high effort with a large max_tokens.temperature, top_p, and top_k at the model level; promptfoo omits them automatically (don't set them in config).# Set your API key
export ANTHROPIC_API_KEY=your_api_key_here
# Run the evaluation
npx promptfoo@latest eval
# View results
npx promptfoo@latest view
Opus 4.8 is also reachable through:
bedrock:us.anthropic.claude-opus-4-8 (or bedrock:converse:us.anthropic.claude-opus-4-8)vertex:claude-opus-4-8 with config.region: globalanthropic:messages:claude-opus-4-8 at https://<resource>.services.ai.azure.com/anthropic via apiBaseUrlAcross all four providers, promptfoo automatically omits the unsupported sampling parameters (temperature, top_p, top_k) for Opus 4.8. The Anthropic Messages provider also logs a one-time warning if you set them explicitly; the Bedrock, Vertex, and Azure paths omit them silently.