Repository navigation
Conversation
thefrojex
requested review from
kerry-berri,
mateo-berri and
ryan-crabbe-berri
as code owners
October 8, 2026 11:53
Contributor
|
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The Vercel AI Gateway sync decided mode with `"embedding" in id`, so ids such as cohere/embed-v4.0, mistral/mistral-embed, mistral/codestral-embed and amazon/titan-embed-text-v2 were written to the cost map as mode "chat" with 0-token context limits - Use the gateway's declared `type == "embedding"` (with an "embed" id fallback) - Correct the 4 existing entries in both cost-map files and drop the bogus 0 max_*_tokens values - Skip zero token limits in the transform so a sync cannot write them back - Add regression tests for the transform and the shipped cost maps
thefrojex
force-pushed
the
fix/vercel-embedding-mode
branch
from
October 8, 2026 15:11
bf98965 to
0c13188
Compare
Author
|
@greptileai review |
2 of 5 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
"mode": "chat"max_*_tokensare a bogus0How it solves it:
type == "embedding""embed"id match stays as a fallbackembedding, with the bogus0limits removedUser Flow
Before: an operator proxies a Vercel embedding model without setting
model_info.mode, and the proxy health check resolves it as a chat modelvercel_ai_gateway/cohere/embed-v4.0to the proxy config with nomodel_info.modemode: chatandmax_input_tokens: 0After: the same deployment is recognised as an embedding model
vercel_ai_gateway/cohere/embed-v4.0to the proxy config with nomodel_info.modemode: embeddingand no0token limitProblem
Four Vercel AI Gateway embedding models are in the cost map as
"mode": "chat"withmax_input_tokens: 0:vercel_ai_gateway/cohere/embed-v4.0vercel_ai_gateway/mistral/mistral-embedvercel_ai_gateway/mistral/codestral-embedvercel_ai_gateway/amazon/titan-embed-text-v2Root cause:
transform_vercel_ai_gateway_datain.github/scripts/auto_update_price_and_context_window_file.pypicks the mode with"embedding" in row["id"].lower(). None of these ids contain the word "embedding" (they sayembed), so they were classified as chat. The gateway's/v1/modelsresponse already declares"type": "embedding"for them, but that field was ignoredImpact: anything that reads
modefrom the cost map treats these as chat models.resolve_health_check_modeinlitellm/proxy/health_check.pyfalls back toget_model_info(...)["mode"], so a proxy deployment of one of these models without an explicitmodel_info.modeis health-checked with a chat request. The0token limits are also wrong and could trip context-window checksFix
type == "embedding", and keep an"embed"id fallbackmax_tokens,max_input_tokensandmax_output_tokenswhen the value is above 0, so a sync can't write zero limits back into the catalogmodel_prices_and_context_window.jsonand the backup): setmode: "embedding"on the 4 entries and remove the bogus0max_*_tokensvalues rather than guessing limitsTests
Added to
tests/unit/test_auto_update_price_and_context_window_file.py:type, and keeps language models aschatcontext_window0 andmax_tokens0 produces no limit fieldsvercel_ai_gateway/*embed*entry in either shipped cost map has a non-embedding modeWithout the fix: 6 failed, 15 passed. With the fix: 21 passed
Pre-Submission checklist
uv run pytest tests/unit/test_auto_update_price_and_context_window_file.py -v(21 passed)make lintpasses locallyScreenshots / Proof of Fix
Setup for both runs: litellm installed editable from the checkout,
LITELLM_LOCAL_MODEL_COST_MAP=Trueso the local cost map is read, not the remote oneBefore (7dd9aff)
vercel_ai_gateway/cohere/embed-v4.0
mainAfter (0c13188)
vercel_ai_gateway/cohere/embed-v4.0
Type
Bug Fix
Caveats (if any)
Medium
resolve_health_check_modedirectly instead of curl against a live proxy, since no Vercel AI Gateway key is available and a live call would fail both before and aftercohere/embed-v4.0was run through the proof script; the other 3 entries are covered by the cost-map guard testmax_*_tokens, since real limits were not guessedLow
embedin its id is also labeled embedding by the fallbackFinal Attestation