Skip to content

AI-credits guard rejects claude-sonnet-5: model is advertised by gh-aw but has no pricing in the curated table or bundled models.dev catalog #5991

Description

@overcookedpanda

Summary

With apiProxy.maxAiCredits active (the default), the api-proxy rejects every request for claude-sonnet-5 with HTTP 400 unknown_model_ai_credits, so any gh-aw workflow pinned to that model fails at its first inference call. The model is missing from both pricing sources the AI-credits guard consults, while the rest of the toolchain already advertises it as available — githubnext/gh-aw (current release v0.81.6) lists claude-sonnet-5 in both pkg/cli/data/models.json and actions/setup/js/models.json, so workflows compile and validate cleanly and then fail at runtime inside the firewall.

This is the same class of failure as #5969 (claude-fable-5), just for a different model. Filing separately since the fix rows differ and Sonnet 5 is the model most orgs will actually move their Sonnet-tier workflows to.

Root cause

containers/api-proxy/guards/ai-credits-guard.js resolves pricing as: curated table (ai-credits-pricing.js) → bundled catalog (models.dev.catalog.json) → defaultAiCreditsPricing → reject. For claude-sonnet-5, every step misses:

  • containers/api-proxy/ai-credits-pricing.js — the Sonnet entries stop at claude-sonnet-4-6 (Opus goes up to claude-opus-4-8, so the table has been maintained past the Sonnet 5 release for other model lines).
  • containers/api-proxy/models.dev.catalog.json — the vendored catalog's newest Sonnet entry is claude-sonnet-4.6 (anthropic/claude-4.6-sonnet-20260217); it predates the Claude Sonnet 5 release and hasn't been re-synced.
  • With maxAiCredits set and no defaultAiCreditsPricing, checkUnknownModelRejection() rejects the request.

The availability/pricing mismatch

The frustrating part is that the model is "available" everywhere except the one layer that can hard-fail the run:

Layer Knows claude-sonnet-5?
gh-aw compiler / models.json (v0.81.6) ✅ compiles and runs workflows pinned to it
Anthropic API behind the proxy ✅ serves the model
AWF curated pricing table
AWF bundled models.dev catalog

So the failure only surfaces at the first model call, deep inside a workflow run, as a 400 from the api-proxy — and the only workarounds throw away cost enforcement (defaultAiCreditsPricing, or disabling the credits budget) or force a revert to claude-sonnet-4-6. We hit exactly this: upgraded our workflows to claude-sonnet-5, every run failed at the first inference call, and we had to revert the model bump.

Suggested fix

Ideally both:

  1. Add a curated row matching Anthropic's published pricing ($/1M tokens — sticker price; Anthropic is running an introductory $2/$10 promo through 2026-08-31, but the sticker rate is the safe value for credits enforcement):
'claude-sonnet-5': { input: 3.00, cachedInput: 0.30, cacheWrite: 3.75, output: 15.00 },

(identical rates to the existing claude-sonnet-4-6 row: input $3, cache read 0.1×, cache write 1.25×, output $15 — per https://platform.claude.com/docs/en/about-claude/models/overview)

  1. Re-sync the vendored models.dev.catalog.json (and consider a scheduled re-bundle) — as also requested in AI-credits guard rejects claude-fable-5: pricing missing from curated table and stale bundled models.dev catalog #5969. Every new model launch currently repeats this failure mode until someone hand-adds a curated row.

Reproduction

Any gh-aw workflow with:

engine:
  id: claude
  model: claude-sonnet-5

and maxAiCredits left at its default fails its first model call with:

HTTP 400 {"type":"unknown_model_ai_credits","message":"Model \"claude-sonnet-5\" has no AI credits pricing and no default pricing is configured. ..."}

The pricing files on main today still lack the model.

🤖 Drafted with the help of Claude Code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions