Skip to content

fix(ci): make the weekly Vercel AI Gateway and Friendli price sync open its PR - #33275

Closed
mateo-berri wants to merge 33 commits into
mainfrom
litellm_fix_pricing_auto_update_action
Closed

mateo-berri wants to merge 33 commits into
mainfrom
litellm_fix_pricing_auto_update_action

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

The weekly job that syncs Vercel AI Gateway and Friendli prices into the cost map has failed every Sunday since July, so newer models like vercel_ai_gateway/anthropic/claude-haiku-5.5 never got a price. This fixes the sync script and the PR step, and adds a manual trigger

It also keeps Vercel's long-context and service-tier prices, so those requests bill at their real rates. OpenRouter is dropped, since its rows left the cost map in #45665 to #45669. Each sync still lands as a PR someone has to review and merge

/stupid

Original

TLDR

Problem this solves:

  • The weekly sync is red every Sunday since July, since its PR step has no git identity, branch, or push
  • It writes only the root cost map, and it still syncs OpenRouter, whose rows are gone
  • It keeps only Vercel's base price, so long-context and priority requests would bill too low
  • It has no manual trigger

How it solves it:

  • Rebuilds the workflow on the Together sync's shape, opening the PR against the default branch and skipping while a sync PR is open
  • Syncs only Vercel AI Gateway and Friendli into both cost map files, and a failed fetch turns the run red before writing
  • Skips and logs a Vercel row whose prices do not parse
  • Writes long-context tiers as _above_<N>k_tokens keys and priority, flex, and ultrafast prices as _<tier> keys
    • A bound within one token of a thousand rounds to it, since an exact _above_271999_tokens key fails the schema and splits one threshold across two names
  • Leaves out a limit the catalog lists as 0, which would read as a real limit, and drops those zeros from 10 entries
  • Turns on the function calling, vision, reasoning, and response schema flags from the catalog's tags, never off

User Flow

Before: every Sunday the sync goes red and no price update PR shows up

  1. Sunday 00:00 UTC, GitHub Actions starts the price sync on main
  2. The "Create Pull Request" step fails with Author identity unknown and the run is red
  3. GET https://github.com/BerriAI/litellm/pulls shows no price update PR
  4. GET https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json still has no vercel_ai_gateway/anthropic/claude-haiku-5.5
  5. gh workflow run auto_update_price_and_context_window.yml answers HTTP 422

After: the sync goes green and opens a PR against main for someone to review

  1. Sunday 00:00 UTC, GitHub Actions starts the same price sync on main
  2. The run is green and opens chore(models): sync vercel_ai_gateway and friendliai prices <date> from litellm_price_map_auto_update_<date>_<run id>
  3. GET https://github.com/BerriAI/litellm/pulls shows that PR, touching only vercel_ai_gateway/ and friendliai/ entries
  4. Once it merges, the same raw cost map URL carries vercel_ai_gateway/anthropic/claude-haiku-5.5 with its per-token prices
  5. gh workflow run auto_update_price_and_context_window.yml starts a run, which skips while a sync PR is open

Relevant issues

Supersedes #33073 by @oskarkocol, which found the Vercel crash first

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

GitHub Actions is the client. The fixed workflow only runs on BerriAI/litellm after merge, so the After leg runs 6109156's copy on real GitHub Actions in a private snapshot repo that keeps only this workflow and swaps the repo guard

Case Before (e333cca) After (6109156)
Sync run Red, no PR Green, opens PR
Synced files None Root and backup match
Tiered prices Never synced One key per tier
Sync PR already open No guard Green, skips
Manual trigger HTTP 422 Run starts

Before (e333cca)

Sync run

  1. The last scheduled run on BerriAI/litellm, 2026-10-18, whose script and workflow match the merge base (https://github.com/BerriAI/litellm/actions/runs/39082229893)
$ gh run view 39082229893 --repo BerriAI/litellm --json conclusion,jobs --jq '{conclusion, steps: [.jobs[0].steps[] | "\(.name): \(.conclusion)"]}'
conclusion: failure
Update JSON Data: success
Create Pull Request: failure
$ gh run view 39082229893 --repo BerriAI/litellm --log-failed | grep -E 'Author identity|fatal|error'
Author identity unknown
fatal: empty ident name (for <runner@runnervm8k3b6...>) not allowed
##[error]Process completed with exit code 128.
Every recent run, and the cost map today
$ gh run list --repo BerriAI/litellm --workflow auto_update_price_and_context_window.yml --limit 8 --json conclusion --jq '[.[].conclusion] | unique'
["failure"]
$ curl -s https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json | jq 'has("vercel_ai_gateway/anthropic/claude-haiku-5.5")'
false

Manual trigger

HTTP 422
$ gh workflow run auto_update_price_and_context_window.yml --repo BerriAI/litellm
could not create workflow dispatch event: HTTP 422: Workflow does not have 'workflow_dispatch' trigger (https://api.github.com/repos/BerriAI/litellm/actions/workflows/99480655/dispatches)

After (6109156)

Sync run

  1. A manual dispatch of the snapshot on 2026-10-21 (https://github.com/mateo-berri/litellm-price-sync-qa/actions/runs/39542967873)
$ gh workflow run auto_update_price_and_context_window.yml --repo mateo-berri/litellm-price-sync-qa --ref litellm_price_sync_qa_33275
$ gh run view 39542967873 --repo mateo-berri/litellm-price-sync-qa --json conclusion,event,jobs --jq '{conclusion, event, steps: [.jobs[0].steps[] | select(.name | test("PR|JSON|Pull")) | "\(.name): \(.conclusion)"]}'
{"conclusion":"success","event":"workflow_dispatch","steps":["Look for an already-open price map update PR: success","Update JSON Data: success","Create Pull Request: success"]}
The run's log
$ gh run view 39542967873 --repo mateo-berri/litellm-price-sync-qa --log | grep -E 'Wrote |pull/2$|\] chore' | cut -f2-
Update JSON Data	2026-10-21T04:22:00.7885452Z Wrote model_prices_and_context_window.json.
Update JSON Data	2026-10-21T04:22:00.7886539Z Wrote litellm/model_prices_and_context_window_backup.json.
Create Pull Request	2026-10-21T04:22:01.1767931Z [litellm_price_map_auto_update_2026-10-21_39542967873 32c2043] chore(models): sync vercel_ai_gateway and friendliai prices 2026-10-21
Create Pull Request	2026-10-21T04:22:04.3957454Z https://github.com/mateo-berri/litellm-price-sync-qa/pull/2
  1. The PR it opened (https://github.com/mateo-berri/litellm-price-sync-qa/pull/2)
The PR's title, branch, and author
$ gh pr view 2 --repo mateo-berri/litellm-price-sync-qa --json title,headRefName,files --jq '{title, headRefName, files: [.files[].path]}'
{"files":["litellm/model_prices_and_context_window_backup.json","model_prices_and_context_window.json"],"headRefName":"litellm_price_map_auto_update_2026-10-21_39542967873","title":"chore(models): sync vercel_ai_gateway and friendliai prices 2026-10-21"}
$ gh api repos/mateo-berri/litellm-price-sync-qa/pulls/2/commits --jq '.[].commit.author | "\(.name) <\(.email)>"'
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The schedule event

A temporary five-minute schedule on the snapshot fired no run in an hour, so the dispatch above stands in for it. The schedule leg differs only in how github.event.repository.default_branch resolves, and the Together sync, which uses the same expression, runs green on schedule every day and opens its PRs against main (https://github.com/BerriAI/litellm/actions/runs/39383201571, #46856)

Synced files

Root and backup match, only the two providers change, and the merged map passes the schema
$ git checkout -q b604363c6f1 && git log --oneline -1 && python3 ci_cd/check_files_match.py
b604363c6f1 chore(models): sync vercel_ai_gateway and friendliai prices 2026-10-21 (#2)
Comparing model_prices_and_context_window and litellm/model_prices_and_context_window_backup.json files... checking if they match.
Passed! Files model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json match.

A diff of PR 2's two files against the snapshot's checked-in ones, and the synced map run through the schema of test_aaamodel_prices_and_context_window_json_is_valid

root == backup: True | trailing newline: True
entries before=4244 after=4541 new=297 changed=41 removed=0
  vercel_ai_gateway/ new=297 changed=39
  friendliai/ new=0 changed=2
other keys touched: []
entries with a negative per-token price: []
synced vercel entries with a zero token limit: []
schema errors, the test's way: 0

Once PR 2 merged, the snapshot's cost map carries the model

$ gh api "repos/mateo-berri/litellm-price-sync-qa/contents/model_prices_and_context_window.json?ref=litellm_price_sync_qa_33275" -H 'Accept: application/vnd.github.raw' | jq -c '."vercel_ai_gateway/anthropic/claude-haiku-5.5" | {input_cost_per_token, output_cost_per_token, max_input_tokens, max_output_tokens}'
{"input_cost_per_token":1E-7,"output_cost_per_token":5E-7,"max_input_tokens":1000000,"max_output_tokens":128000}

Tiered prices

Long-context and service-tier prices land as their own keys
$ gh api "repos/mateo-berri/litellm-price-sync-qa/contents/model_prices_and_context_window.json?ref=litellm_price_sync_qa_33275" -H 'Accept: application/vnd.github.raw' | jq -c '."vercel_ai_gateway/openai/gpt-6.1-sol" | with_entries(select(.key | startswith("input_cost_per_token")))'
{"input_cost_per_token":0.000002,"input_cost_per_token_above_272k_tokens":0.000004,"input_cost_per_token_flex":0.000001,"input_cost_per_token_above_272k_tokens_flex":0.000002,"input_cost_per_token_priority":0.000004,"input_cost_per_token_above_272k_tokens_priority":0.000008,"input_cost_per_token_ultrafast":0.000012,"input_cost_per_token_above_272k_tokens_ultrafast":0.000024}

Sync PR already open

A second dispatch while PR 2 was still open

https://github.com/mateo-berri/litellm-price-sync-qa/actions/runs/39543914013

$ gh run view 39543914013 --repo mateo-berri/litellm-price-sync-qa --json conclusion,jobs --jq '{conclusion, steps: [.jobs[0].steps[] | "\(.name): \(.conclusion)"]}'
{"conclusion":"success","steps":["Set up job: success","Run actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955: success","Set up uv: success","Look for an already-open price map update PR: success","Update JSON Data: skipped","Create Pull Request: skipped","Post Set up uv: success","Post Run actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955: success","Complete job: success"]}
$ gh run view 39543914013 --repo mateo-berri/litellm-price-sync-qa --log | grep 'Skipping the sync:' | tail -1 | cut -f2-
Look for an already-open price map update PR	2026-10-21T04:25:17.9677536Z Skipping the sync: the price map update PR on litellm_price_map_auto_update_2026-10-21_39542967873 is still open

Manual trigger

Run starts

Both runs above are workflow_dispatch events started with gh workflow run

Type

🐛 Bug Fix
🚄 Infrastructure

Caveats (if any)

Low

  • Vercel's regional, fast-mode, and varies-by-provider prices are left out, so those requests bill at the default rate
  • A tier bound at an exact thousand bills a prompt of exactly that size at the lower rate
  • The first sync PR re-expands about 100 hand-compacted lines, whitespace only

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
Bugbot summary

[!NOTE]
Medium Risk
Changes how model pricing JSON is produced and merged (cost calculation data), with a large first sync PR expected; workflow and validation reduce silent bad prices but upstream catalog errors still depend on human review.

Overview
Repairs the weekly automated price-map sync so it can finish and open a reviewable PR again, after the create-PR step had been failing (missing git identity / push).

The sync script now pulls only Vercel AI Gateway and Friendli (OpenRouter removed to avoid conflicting with the daily provider sync), validates Vercel catalog rows with Pydantic, and keeps language/embedding models that have usable per-token prices while skipping video/image/unpriced or negative-price entries. It writes both model_prices_and_context_window.json and the backup copy in a stable UTF-8 JSON format.

The GitHub Action adds workflow_dispatch, checks out the default branch, skips the run when a litellm_price_map_auto_update_* PR is already open, exits without a PR when there is no diff, and otherwise commits as github-actions[bot] with branch push and gh pr create against the default branch. Unit tests cover the new Vercel filtering, invalid price failures, and file output format.

Reviewed by Cursor Bugbot for commit 99eb06c. Bugbot is set up for automated code reviews on this repo. Configure here.

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai


Generated by Claude Code

@greptile-apps

greptile-apps Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR affects shared model price data used in LiteLLM cost calculations.

Clear removed Vercel price fields before merging so future syncs cannot keep billing obsolete rates

Findings

  1. P1 Removed prices keep billing ▶
  2. P2 Boundary requests cost too little ▶
  3. P2 Same-day retries fail ▶

Summary

Repairs the weekly Vercel AI Gateway and Friendli price sync and adds a manual trigger

  • Vercel and Friendli price sync writes usable rates to both cost maps.
  • The weekly price sync opens a review PR when the maps change.

Reviews (15) · Last reviewed commit: "fix(ci): carry tiered and service-tier p..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 34 untouched benchmarks


Comparing litellm_fix_pricing_auto_update_action (6109156) with main (0e24bbb)

Open in CodSpeed

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai


Generated by Claude Code

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai


Generated by Claude Code

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run


Generated by Claude Code

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Resume branch drops pricing entries
    • Added a git merge --no-edit origin/${BASE_BRANCH} step after checking out an existing dated branch so any pricing entries added to the default branch since the dated branch was cut are included before the Python script rewrites the JSON.

Create PR

Or push these changes by commenting:

@cursor push bd5f928cab
Preview (bd5f928cab)
diff --git a/.github/workflows/auto_update_price_and_context_window.yml b/.github/workflows/auto_update_price_and_context_window.yml
--- a/.github/workflows/auto_update_price_and_context_window.yml
+++ b/.github/workflows/auto_update_price_and_context_window.yml
@@ -33,6 +33,7 @@
           git fetch origin "${BASE_BRANCH}" "${BRANCH_NAME}" || true
           if git show-ref --verify --quiet "refs/remotes/origin/${BRANCH_NAME}"; then
             git checkout -B "${BRANCH_NAME}" "origin/${BRANCH_NAME}"
+            git merge --no-edit "origin/${BASE_BRANCH}"
           else
             git checkout -b "${BRANCH_NAME}" "origin/${BASE_BRANCH}"
           fi

You can send follow-ups to the cloud agent here.

@mateo-berri
mateo-berri marked this pull request as ready for review July 21, 2026 21:45
@mateo-berri
mateo-berri requested a review from a team July 21, 2026 21:45
@yuneng-berri
yuneng-berri deleted the branch main September 13, 2026 04:31
auto-merge was automatically disabled September 13, 2026 04:31

Pull request was closed

@mateo-berri mateo-berri reopened this Sep 15, 2026
@mateo-berri
mateo-berri changed the base branch from litellm_internal_staging to main September 15, 2026 17:12
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litellm-stampbot

@kerry-berri

kerry-berri commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

litellm-stampbot: risk high

Not approved at 99eb06c. risk is high, a human reviewer is needed.

Rules (stampbot/risk_rules.yml):

  • high: Cursor Bugbot has no risk line for the head 99eb06c (run already finished), not approving without it. Comment @litellm-stampbot again once Bugbot has reviewed the head

Judge: skipped, the rules alone decided.

Pushes do not re-run this check. Comment @litellm-stampbot again to re-check the new head.

@kerry-berri kerry-berri added the risk:high Sensitive, broad, or high-risk change label Oct 21, 2026
…uto_update_action

# Conflicts:
#	.github/scripts/auto_update_price_and_context_window_file.py
#	.github/workflows/auto_update_price_and_context_window.yml
#	tests/unit/test_auto_update_price_and_context_window_file.py
@mateo-berri mateo-berri changed the title fix(ci): make the weekly model price auto-update workflow open its sync PR fix(ci): make the weekly Vercel AI Gateway and Friendli price sync open its PR Oct 21, 2026
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@litereview

litereview Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

⚠️ code-review

5/5 · Ready for human review

Scope: full · Full PR review.

Completed · Some checks not run.

No correctness findings.

Checks and execution details
  • Passed · real-testing-evidence (required): Not applicable: no LLM translation changes in the scoped paths. The changed files are .github/scripts/auto_update_price_and_context_window_file.py, .github/workflows/auto_update_price_and_context_window.yml, the two cost map JSON files, tests/unit/test_auto_update_price_and_context_window_file.py and tests/unit/test_utils.py. None of them is under litellm/llms/** or litellm/litellm_core_utils/prompt_templates/**.

  • Passed · compatibility-notice (required): I found no supported behavior that breaks. The checked-in JSON change only removes max_tokens/max_input_tokens/max_output_tokens values of 0 from 10 vercel_ai_gateway embedding entries. With a value of 0, a caller reading these fields would treat the context limit as zero tokens. Now the fields are absent, which is the standard way to say the limit is unknown. The workflow and script are CI-internal. Dropping OpenRouter does not remove any cost map rows, because refactor(cost-map): remove openrouter rows, part 1 of 5 #45665 to refactor(cost-map): remove openrouter rows, part 5 of 5 #45669 already removed them. The PR needs no breaking-change marker.

  • Passed · behavioral-coverage (required): I read the root and tests/unit AGENTS guidance. Paths I traced:

  • main(): both catalog fetches run before any file write, and a failed fetch exits non-zero first (tested).

  • transform_vercel_ai_gateway_data: pydantic models, then _vercel_entry, then sync_local_data_with_remote, then write_to_file for both paths.

  • Tier keys: tier keys flow into _get_token_base_cost in litellm/litellm_core_utils/llm_cost_calc/utils.py, where _parse_above_token_threshold and the strict > comparison apply. A Vercel min: 100001 maps to above_100k, which matches.

  • Service tier keys: *_priority keys and *_above_Nk_tokens_priority keys flow through the same cost path. The parametrized test exercises the real _get_token_base_cost at 272000/272001 prompt tokens, with and without priority.

Boundary cases I checked:

  • Zero context_window/max_tokens is dropped through or None.
  • A missing or negative input price, or a missing chat output price, skips the row.
  • Unknown service tiers are dropped (tested).
  • Tags only turn capability flags on, never off (tested).

I also fetched the live Vercel catalog (482 rows, including multi-tier rows such as alibaba/qwen3-max-thinking). I ran the script against copies of both maps, and the merged output passed test_aaamodel_prices_and_context_window_json_is_valid.

  • Passed · Sync script unit tests (optional): .venv/bin/python -m pytest tests/unit/test_auto_update_price_and_context_window_file.py -q: 26 passed.
  • Passed · Live sync output against cost map schema (optional): I ran the PR script in /tmp/sim against the live Vercel and Friendli catalogs. It printed Wrote model_prices_and_context_window.json. and Wrote litellm/model_prices_and_context_window_backup.json.. I swapped the synced root map in temporarily and ran pytest tests/unit/test_utils.py -k aaamodel_prices: 1 passed. Afterwards I restored the original file and verified it with cmp.
  • Not run · Workflow run on BerriAI/litellm (optional): The workflow only runs on BerriAI/litellm after merge. The PR description links a green dispatch on a snapshot repo (run 39542967873) that opened PR Enable model / call timeouts #2, plus a skip run (39543914013). I did not re-execute GitHub Actions.

View review · Reviewed 61091564f09a

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview guide

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 99eb06c. Configure here.

@litereview

litereview Bot commented Oct 21, 2026

Copy link
Copy Markdown

⚠️ guide

Open preview

Scope: full · Full PR review.

Completed · Some checks not run.

Today the weekly Vercel AI Gateway and Friendli price sync fails every Sunday, so models like vercel_ai_gateway/anthropic/claude-haiku-5.5 never get a price in the cost map.

The walkthrough, stop by stop

  1. Job starts: it runs on Sundays only. A manual run returns HTTP 422 today. After the fix, workflow_dispatch adds a manual run, and the job skips the sync while an earlier sync PR is still open.
  2. Read the catalogs: today it reads OpenRouter, Vercel and Friendli. After the fix it reads only Vercel and Friendli and checks Vercel rows with pydantic. It skips rows with no price, and a NaN or non-numeric price stops the run.
  3. Write the price files: today it writes only the root cost map. After the fix it writes the root file and the packaged backup, in the checked-in format.
  4. Commit the change: breaks here with Author identity unknown, exit 128. Fixed here: the job commits as github-actions[bot] on a dated branch, then pushes that branch.
  5. Open the sync PR: today the run never gets here. After the fix it opens a PR against the default branch.
  6. Someone reviews it: same both ways. A person still has to merge each sync PR.
  7. Caller asks for a price: today there is no entry. Once the sync PR merges, the new entries have per-token prices.

What changes for the caller: new and corrected Vercel and Friendli prices arrive through a sync PR again. I ran the PR's script locally against the live catalogs on 2026-10-21: 297 new entries, 29 changed, both files identical, and claude-haiku-5.5 priced at 1e-07 in and 5e-07 out.

Tests added: 3 new unit tests and 1 updated one, covering Vercel row filtering, failing on bad prices, and the output file format. All 17 tests in the file pass locally.

Black box coverage: Not needed. Only a CI job and its script change. Nothing in the running proxy or SDK changes. The workflow steps (git identity, push, opening the PR) only get proven on a real GitHub run.

Checks and execution details
  • Passed · Unit tests for the sync script (optional): Ran .venv/bin/python -m pytest -q tests/unit/test_auto_update_price_and_context_window_file.py: 17 passed.
  • Passed · Local run of the sync script against live catalogs (optional): Ran the PR's script in a scratch copy of both cost map files. Both files were written and are byte-identical. Entries went from 4244 to 4541 (297 new, 29 changed), all under vercel_ai_gateway/ (324) or friendliai/ (2). No entry has a negative price. vercel_ai_gateway/anthropic/claude-haiku-5.5 came out at input 1e-07, output 5e-07.
  • Not run · Live GitHub Actions dispatch of the workflow (optional): This needs the real repository and its tokens. The before-failure log (Author identity unknown) comes from the PR description, run 39082229893.

View review · Reviewed 99eb06cd666b

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litellm-stampbot

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

exit 0
fi
today="$(date +'%Y-%m-%d')"
branch="litellm_price_map_auto_update_$today"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Same-day retries fail

If PR creation fails after the push, a same-day retry creates a new commit on the same dated branch. The open-PR guard misses the leftover branch, and git push rejects the new commit. Reuse the branch or give retries unique names

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

Comment on lines +373 to +374
all_remote_data: Final = {**transform_vercel_ai_gateway_data(vercel_rows), **friendli_data}
sync_local_data_with_remote(local_data, all_remote_data, replace_keys=frozenset(friendli_data))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Removed prices keep billing

When Vercel removes or moves a price tier, this sync keeps the old price fields because only Friendli entries are replaced. Billing still reads those fields, so later syncs can keep recording obsolete prices. Clear previously synced price fields before merging current rates

Knowledge Base Used: Provider adapters and capabilities

Comment on lines +270 to +272
def _threshold_label(lower_bound: int) -> str:
thousands: Final = round(lower_bound / 1000)
return f"{thousands}k" if abs(lower_bound - thousands * 1000) <= 1 else str(lower_bound - 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Boundary requests cost too little

An exact-thousand min, such as 272000, becomes a strict “above 272k” threshold. A request exactly at that minimum then uses the lower price for its whole prompt. Preserve the inclusive boundary when converting the tier

@mateo-berri

Copy link
Copy Markdown
Contributor Author

Closing, since #48473 removed this workflow from main. Vercel AI Gateway and Friendli prices still need a source in the provider pricing sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Sensitive, broad, or high-risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants