Skip to content

feat: refresh model list against vendor docs, Cloudflare first (#112 phase 2) - #123

Merged
stackbilt-admin merged 6 commits into
mainfrom
feat/112-model-refresh
Oct 15, 2026
Merged

stackbilt-admin merged 6 commits into
mainfrom
feat/112-model-refresh

Conversation

@stackbilt-admin

@stackbilt-admin stackbilt-admin commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Refs #112 (phase 2). Unreleased; no version bump in this PR.

Every value was checked against vendor primary docs on 2026-10-15:

  • Cloudflare: each Workers AI model page, the pricing page, and the 2026-05-08 and 2025-09-18 deprecation posts.
  • OpenAI: developers.openai.com models, pricing and deprecations pages.
  • Anthropic: platform.claude.com models overview, pricing, deprecations and the 5.x migration guides.

No live or billable vendor requests were made.

Review history.

  • Round 1: making the new Claude 5.x and GPT-5.6 models the defaults would break live calls. They are now explicit-only, the adapter request shapes are fixed, and a JSON-mode bug that already affects 1.22 is fixed.
  • Round 3 (verdict "ready to merge"): follow-ups applied: the timeout note now mentions retries, the README states which Anthropic model each request shape gets, the gpt-4o-mini cost test runs through the factory and checks the ledger, and mutation counts cover every test file.
  • Round 2 (verdict "merge after fixes"): no code blockers. This revision corrects false or missing release notes, restores the { in streamed JSON on prefilled models, and adds factory-level and streaming tests. It also opens Anthropic adapter sends tool_result blocks without tool_use_id, so multi-turn tool use fails #124: tool_result blocks are sent without tool_use_id, an older bug that affects every Claude model.

Cloudflare (primary provider)

  • Retired in the catalog: the 12 models Cloudflare deprecated.
    • On 2026-05-30: Llama 3.1 8B and 70B, Llama 3 8B, Llama 2 7B int8, Phi-2 and Mistral 7B v0.1.
    • On 2025-10-01: OpenChat 3.5, TinyLlama and the four Qwen 1.5 models.
    • They were compatibility, so routing could still pick them. They now stay accepted by name but are never auto-routed.
  • Context windows corrected:
    • Llama 3.3 70B FP8 Fast: 24,000 (was 131,072)
    • Llama 3.2 1B: 60,000
    • Llama 3.2 3B: 80,000
    • Qwen3 30B: 32,768
    • Kimi K2.6 and K2.7 Code: 262,144
    • DeepSeek V4 Flash: 1,048,576
  • Kimi K2.7 Code gains vision.
  • Qwen 2.5 Coder no longer claims function calling, because Cloudflare's model page doesn't list it.
  • AI Gateway unified-catalog models:
    • deepseek/deepseek-v4-pro and anthropic/claude-opus-4.8 were priced at $0. They now cost $1.74/$3.48 and $5/$25 per million tokens.
    • Opus 4.8 no longer receives temperature or top_p, which Claude 4.7 and later reject.
  • Added:
    • @cf/meta/llama-3.1-8b-instruct-fp8
    • @cf/ibm-granite/granite-4.0-h-micro
    • @cf/aisingapore/gemma-sea-lion-v4-27b-it (explicit-only)
  • Ranking test: a Workers AI model must rank first for every use case when all six providers are configured and healthy.

New ModelCatalogEntry.explicitOnly

This is an optional, additive field. An explicit-only model is served when a request names it, but recommendations and automatic routing skip it.

It is set on the new OpenAI models, the Claude 5.x models and SEA-LION. OpenAI and Anthropic defaults stay where they were in 1.22:

  • gpt-4o-mini for every OpenAI use case;
  • for Anthropic: Haiku 4.5 for general and cost-effective requests, Sonnet 4.6 for tools, vision and long context, and Opus 4.6 for high-performance and research.

Routing that does change, because the data was corrected:

  • Cloudflare long-context requests now pick GLM-5.3 Flash instead of DeepSeek V4 Flash, because DeepSeek's context window was corrected from 1.31M to 1.05M.
  • Llama 3.1 8B FP8 and Granite 4.0 Micro join the recommendation lists, though neither ranks first.
  • OpenAI's fallback pool is now just gpt-4o-mini.

OpenAI

  • Shutting down 2026-10-23: gpt-4, gpt-4-turbo and gpt-3.5-turbo are retired and no longer auto-routed, but are still accepted by name.
  • gpt-3.5-turbo-16k is no longer a valid ID and is also retired.
  • gpt-4o-mini stays the default. getRoutingInfo() reports its 2027-01-14 shutdown; response metadata doesn't, because the model is still active.
  • Added (explicit-only): gpt-6-astra, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna and gpt-5.5.
    • Requests to them send max_completion_tokens instead of max_tokens, and no temperature.
    • Dropping temperature is an inference; OpenAI's model pages don't say whether these models accept it.
  • Cost fixes:
    • A response naming a dated snapshot was priced at $0. It is now priced by its alias.
      • This includes the default gpt-4o-mini, whose responses name gpt-4o-mini-2024-07-18. Ledgers and budgets will start showing real spend for it after upgrading.
      • Snapshot IDs without a date suffix are still unpriced.
    • Prompts over 272K tokens on the new models bill at 2x input and 1.5x output.

Anthropic

  • Added (explicit-only): claude-fable-5-1, claude-opus-5-5, claude-sonnet-5-5 and claude-haiku-5-5.
    • Requests omit temperature.
    • max_tokens defaults to 16,000, because these models think by default and thinking counts against max_tokens.
    • Forced tool choice on Fable 5.1, Opus 5.5 and Sonnet 5.5 throws a ConfigurationError before any API call, since those models return 400 for it. Haiku 5.5 still accepts it.
  • JSON mode fix: the adapter no longer sends an assistant prefill to Opus 4.6, Sonnet 4.6 or the 5.x models.
    • Anthropic's guide says Sonnet 4.6 and later reject prefill with a 400. That means 1.22 JSON mode on the default claude-sonnet-4-6 already fails today.
    • These models rely on the JSON system instruction instead.
    • The { is restored only when it was prefilled, on both the non-streaming and streaming paths. Streaming previously never restored it.
  • Pricing: cache reads use per-model rates, and Haiku 5.5 prompts over 100K tokens bill at the 5x rate.
  • Legacy models: Opus 4.6, Sonnet 4.6 and Haiku 4.5 stay active, with a "legacy" note in their descriptions.

Known limitations (still open on #112)

  • Thinking blocks in tool loops (Anthropic adapter sends tool_result blocks without tool_use_id, so multi-turn tool use fails #124): Claude 5.x thinking blocks are not passed back with tool results, and tool_result blocks lack tool_use_id. This is why the 5.x models are explicit-only.
  • Timeouts: the 30-second default timeout can cut off long non-streaming Fable 5.1 and Opus 5.5 responses at the new 16,000-token default. Timeouts are retried (maxRetries, default 3), so a request can take about two minutes before fallback, and each attempt may be billed. This is documented, not changed.
  • Qwen 2.5 Coder: requests to it that include tools now throw a ConfigurationError before any call.
  • Unsupported OpenAI models: gpt-6-luna and gpt-6.1-sol restrict tool calling on Chat Completions.
  • Not modelled yet:
    • OpenAI cached-input pricing;
    • Cerebras, Groq and NVIDIA prices and IDs;
    • a custom-model escape hatch;
    • unknown-cost semantics.

Validation

  • tsc --noEmit, full vitest (789 tests; model-refresh.test.ts has 125), build, test:package and test:worker-import all pass.

  • Factory-level tests now cover:

    • named explicit-only models being served by their own provider;
    • unnamed requests never landing on an explicit-only model;
    • forced tool choice failing on both the generate and stream paths without any provider call;
    • toolChoice: 'none'.
  • factory.test.ts and catalog-accuracy.test.ts are unchanged from main.

  • Undoing each fix makes its tests fail (counts across all test files):

    Fix Tests that fail without it
    explicitOnly exclusion 19 (14 in model-refresh, 2 in model-catalog, 3 in factory)
    Streamed { restore 1
    Streamed restore check 1
    Prefill check 6
    Brace-restore check 6
    Forced tool choice 5
    5.x max_tokens 2
    Snapshot pricing 2 (including the factory ledger test)
    OpenAI long-prompt rate 1
    Opus 4.8 sampling 1
    OpenAI reasoning parameters 6
    Anthropic temperature 4
    Cache-read rates 3
    Haiku 5.5 long-prompt rate 1

🤖 Generated with Claude Code

kovermier and others added 3 commits October 15, 2026 17:50
…phase 2)

Workers AI: retire the 12 models Cloudflare deprecated (still accepted by
name, never auto-routed), correct seven context windows, drop the unlisted
function-calling claim on Qwen 2.5 Coder, price the two AI Gateway unified
catalog models, and add Llama 3.1 8B FP8, Granite 4.0 Micro and SEA-LION v4.

OpenAI: add GPT-6 Astra and GPT-5.6 Sol/Terra/Luna and GPT-5.5 before the
2026-10-23 shutdown of gpt-4, gpt-4-turbo and gpt-3.5-turbo (now retired in
the catalog). Reasoning models get max_completion_tokens and no temperature.

Anthropic: add Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5; mark 4.6 and
Haiku 4.5 as legacy; omit temperature for 5.x; per-model cache-read rates
and the Haiku 5.5 long-prompt rate.

A new test requires a Workers AI model to rank first for every use case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fable 5.1 and Opus 5.5 always think, and thinking counts against
max_tokens, so the adapter's 1000-token default could leave no room for
the answer. Requests that set no maxTokens now default to 16000 for these
two models; estimateCost uses the same default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…them

Addresses the PR #123 review.

- Add optional ModelCatalogEntry.explicitOnly; the new OpenAI and Claude
  5.x models and SEA-LION are served only when named, so default routing
  stays on gpt-4o-mini and Claude 4.6 / Haiku 4.5 (lifecycles back to
  active; descriptions keep the shutdown/legacy notes).
- Anthropic: no JSON prefill for Claude 4.6 and later (400 from Sonnet 4.6
  on, so 1.22 JSON mode on claude-sonnet-4-6 already failed); restore the
  '{' only when prefilled. Forced tool choice on Fable 5.1, Opus 5.5 and
  Sonnet 5.5 throws a ConfigurationError before the call. Default
  max_tokens 16000 for all four 5.x models.
- OpenAI: price dated snapshots by alias (was $0) and bill prompts over
  272K at 2x/1.5x on the new 1M-context models.
- Cloudflare: stop forwarding temperature/top_p to Claude Opus 4.8.
- GPT_4O_MINI note names OpenAI's actual replacement; README claim scoped.
- Restore factory.test.ts to main's content and 100755 mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kovermier and others added 3 commits October 15, 2026 18:18
…tests

Addresses the second PR #123 review.

- CHANGELOG: gpt-4o-mini's shutdown shows in getRoutingInfo, not response
  metadata; list the routing changes from corrected data (Cloudflare
  long-context pick, new pool members, smaller OpenAI pool), the
  gpt-4o-mini cost change from $0, the new Qwen Coder tools error, and
  the 30s timeout caveat for 16K-token Claude 5.x responses.
- README: Kimi K2.5 and Gemma 3 are no longer accepted; Anthropic
  defaults are per use case.
- Streaming JSON mode restores the prefilled '{' (Haiku 4.5), matching
  generateResponse.
- Factory-level tests: explicit-only models are served when named and
  never picked otherwise; forced tool choice on Sonnet 5.5 fails on
  generate and stream without calling any provider; toolChoice 'none'.
- Link #124 (tool_result sent without tool_use_id).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pend via factory

Addresses the third PR #123 review.

- CHANGELOG and README: a timed-out non-streaming Claude 5.x request is
  retried (maxRetries, default 3), so it can take about two minutes
  before fallback and each attempt may be billed.
- README: Anthropic defaults follow request shape (JSON mode goes to
  Sonnet 4.6); Opus 4.6 only for high-performance/research workloads.
- The gpt-4o-mini snapshot-pricing test now runs through LLMProviders
  and checks the CreditLedger records the spend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stackbilt-admin
stackbilt-admin merged commit c16a93d into main Oct 15, 2026
2 checks passed
@stackbilt-admin
stackbilt-admin deleted the feat/112-model-refresh branch October 15, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants