FAL pricing extract: send Cloudflare's catalog model id to AI Gateway (#556) #557
main fromrefs/pull/557/head·merged by tombeckenham View on GitHubCloses #556.
What#
Every AI Gateway call from the FAL pricing extract has 500'd since #551: the binding got anthropic/claude-sonnet-5-5 (Anthropic's id), but Cloudflare's catalog id is anthropic/claude-sonnet-5.5.
GATEWAY_MODEL_IDSmaps each Anthropic id to its catalog id (claude-sonnet-5.5,claude-haiku-5.5).gatewayChatrewritesmodelon the request handed tocloudflareBindingFetch. The adapter keeps Anthropic's id because it reads its own model table (defaultmax_tokens, reasoning) at runtime; an unknown id would lose that. An unmapped id throws rather than sending a guess.- The gateway test now asserts
ai.runreceivesanthropic/claude-sonnet-5.5. scripts/compare-fal-extract-models.tsstand-in maps the dotted id back for Anthropic's API.
After deploy#
-
POST /v1/admin/extract/faland confirm a 200 in themodelschemasgateway logs. - Upstream:
@tanstack/ai-cloudflare's doc example ('claude-opus-5-5') has the same mismatch — not filed from here.
Summary by CodeRabbit#
- Bug Fixes
- Improved compatibility when extracting pricing data with Anthropic models. Model identifiers are now formatted to match the gateway catalog, helping requests reach the intended model and supporting consistent extraction across the supported Anthropic models.
- 1
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1b86bbfb-04ca-406e-98d2-ee7742257afd
Commits-
Reviewing files that changed from the base of the PR and between 9f8eb3f2f4f210587a39546e6b22879fbb201912 and 77ad4437ef5b59e385e66855b1f4c87bc5811de7.
Files selected for processing: 3-
scripts/compare-fal-extract-models.tssrc/server/ingest/extract-fal-pricing.test.tssrc/server/ingest/extract-fal-pricing.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
-
Walkthrough
-
The FAL pricing extractor now rewrites Anthropic model IDs to Cloudflare catalog IDs before sending gateway requests. The model comparison stand-in converts dotted model identifiers to hyphenated Anthropic identifiers.
Changes: FAL gateway model mapping
Layer / File(s) Summary Model mapping and request rewrite
src/server/ingest/extract-fal-pricing.ts,src/server/ingest/extract-fal-pricing.test.ts,scripts/compare-fal-extract-models.tsThe extractor maps Sonnet and Haiku model names to Cloudflare catalog IDs and rewrites string request bodies before forwarding them. The test expects anthropic/claude-sonnet-5.5. The comparison stand-in converts periods in model identifiers to hyphens.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
- TanStack/modelschemas#552: The issue describes failures on the same FAL pricing gateway request path and identifies a possible model ID mismatch. This PR changes the ID mapping for that path, but does not report confirmation that the failure is resolved.
Merge Risk:
Minimal · up to77ad4-
No concrete merge-blocking defect remains in the reviewed change; the requested post-deploy check is still operational follow-up.
Pre-merge checks:
5-
Check name Status Explanation Description Check Check skipped - CodeRabbit’s high-level summary is enabled. Title check The title clearly and concisely describes the main change: sending Cloudflare’s catalog model ID to AI Gateway for the FAL pricing extract. Linked Issues check Issue [ #556] requires Cloudflare catalog IDs for the FAL gateway calls and a unit test for the Sonnet ID.GATEWAY_MODEL_IDSmapsclaude-sonnet-5-5toclaude-sonnet-5.5andclaude-haiku-5-5to …Out of Scope Changes check The changes remain within issue [ #556]. The comparison-script reverse mapping supports the gateway model-ID change. The test update verifies the required behavior. No unrelated implementation is prese…Docstring Coverage Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Full details: Linked Issues check
-
Explanation
Issue [
#556] requires Cloudflare catalog IDs for the FAL gateway calls and a unit test for the Sonnet ID.GATEWAY_MODEL_IDSmapsclaude-sonnet-5-5toclaude-sonnet-5.5andclaude-haiku-5-5toclaude-haiku-5.5.withGatewayModelrewrites the request body beforecloudflareBindingFetchsends it. The test asserts thatai.runreceivesanthropic/claude-sonnet-5.5. The post-deploy 200 check is a manual operational task, not a coding requirement.
Full details: Out of Scope Changes check
-
Explanation
The changes remain within issue [
#556]. The comparison-script reverse mapping supports the gateway model-ID change. The test update verifies the required behavior. No unrelated implementation is present. The upstream documentation issue remains outside this pull request, as required.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
-
tombeckenham merged thisc2c3b34
tombeckenham closed this
Sign in to join this conversation.
⚠️ No Changeset found#
Latest commit: 77ad4437ef5b59e385e66855b1f4c87bc5811de7
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR