Repository navigation
feat(cost-map): add Cohere north-large-01-2026 with its context window and capabilities - #46589
mateo-berri wants to merge 3 commits into
Conversation
…w and capabilities
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Automatic reviews are disabled for this repository. |
|
bugbot run |
|
@litereview code-review |
✅ code-review5/5 · Ready for human reviewScope: full · Full PR review. No correctness findings. The PR adds the same Checks and execution details
View review · Reviewed |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…at route rejects for north-large-01-2026
|
bugbot run |
|
@litereview code-review |
…s for north-large-01-2026
|
bugbot run |
|
@litereview code-review |
| "supports_function_calling": true, | ||
| "supports_tool_choice": true | ||
| }, | ||
| "north-large-01-2026": { |
There was a problem hiding this comment.
Medium · /model/info reports tool_choice as unsupported for north-large, contradicting the PR
- An admin deploys
cohere_chat/north-large-01-2026, as in the PR's user flow. - The admin or a client checks capabilities with
GET /v1/model/infoorlitellm.get_model_info(...). A client can also calllitellm.utils.supports_tool_choice(...). - The new cost-map entry sets
supports_function_callingandsupports_vision, but has nosupports_tool_choicekey. get_model_inforeturnssupports_tool_choice: None, andsupports_tool_choice()returnsFalse. The PR's Decisions section says the entry sets this flag, and its After proof shows"supports_tool_choice": true. Clients that check this flag before sendingtool_choicewill skip a feature the author confirmed works live. Every other function-callingcohere_chatentry sets the flag.
To fix this, add "supports_tool_choice": true to both model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json. Then refresh the proof against the head commit.
Evidence
Diff entry keys: litellm_provider, max_input_tokens, max_output_tokens, max_tokens, mode, source, supports_function_calling, supports_vision (no supports_tool_choice)
PR Decisions: "The entry sets only what the cohere_chat route accepts today, supports_function_calling, supports_tool_choice, and supports_vision, each sent live."
PR After proof (commit 954ddd9): north-large {... "supports_function_calling": true, "supports_tool_choice": true, ...}
Executed on head: LITELLM_LOCAL_MODEL_COST_MAP=True python3 -c "...get_model_info('cohere_chat/north-large-01-2026')..." -> 256000 65536 True None True 0; supports_tool_choice('cohere_chat/north-large-01-2026') -> False; supports_tool_choice('cohere_chat/command-a-03-2025') -> True
Other cohere_chat entries with supports_function_calling=true (command-a-03-2025, command-a-plus-05-2026, command-r-08-2024, command-r-plus-08-2024, command-r7b-12-2024) all set supports_tool_choice=true
Latest summary by code-review · View this review · Reviewed 360fc17d0005
There was a problem hiding this comment.
The body now matches 360fc17. The flag is unset on purpose, since the cohere_chat route drops tool_choice, and the proof ran again there
There was a problem hiding this comment.
Finding withdrawn
Thanks for clarifying. The finding rested on two points, and neither holds at head 360fc17d00.
- The PR body no longer contradicts the entry. The Decisions section now says
supports_tool_choiceis unset because the route dropstool_choice. The caveats list this as fixed in360fc17d00. The old After proof showedtrue, but the current body no longer uses it. - The flag would be false advertising.
CohereChatConfig.map_openai_paramsandCohereV2ChatConfig.map_openai_paramsboth listtool_choiceas a supported param but never copy it intooptional_params. I confirmed this on head: atool_choice='none'request reaches Cohere withouttool_choice. Settingsupports_tool_choice: truewould tell clients the route honors a parameter it silently discards.
Other cohere_chat entries do set the flag, but those entries are the inaccurate ones. That inconsistency is out of scope for this PR and gives no reason to copy the inaccuracy.
Evidence
litellm/llms/cohere/chat/transformation.py:166-213: get_supported_openai_params includes "tool_choice", but map_openai_params has no branch for tool_choice.
litellm/llms/cohere/chat/v2_transformation.py:119-157: same pattern in the v2 config.
litellm/utils.py:4658: both cohere_chat and cohere route through CohereChatConfig().map_openai_params.
Executed on head with LITELLM_LOCAL_MODEL_COST_MAP=True: get_optional_params(model='north-large-01-2026', custom_llm_provider='cohere_chat', tools=[...], tool_choice='none') returns {'stream': False, 'tools': [...]}, so tool_choice is dropped. CohereV2ChatConfig().map_openai_params({'tool_choice':'none'},{},'x',False) returns {}.
The PR body Decisions section now reads: "supports_tool_choice stays unset too, because the route drops tool_choice before sending, so tool_choice: \"none\" still returned a tool call".
GitHub does not allow this App to resolve this thread. A repository maintainer must do it manually.
Reviewed 360fc17d0005 · View follow-up
|
@litereview code-review |
|
bugbot run |
There was a problem hiding this comment.
✅ 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 360fc17. Configure here.
|
Absorbed north-large-01-2026 into #46742, keeping the verified 256K context and dropping the unpublished 65536 output limit, closing as superseded |
|
Update: north-large-01-2026 was also dropped from #46742, since an entry with no published price logs $0 spend instead of erroring |
TLDR
Problem this solves:
north-large-01-2026is missing from the cost map/model/infoand the SDK know nothing about its limits or capabilitiesHow it solves it:
cohere_chatroute honors, function calling and vision/model/infoshows null, not $0User Flow
Before: requests answer, but LiteLLM knows nothing about the model's limits or features
north-largewithmodel: cohere_chat/north-large-01-2026and restarts the proxy"model": "north-large"and gets a 200 answermax_input_tokens,max_output_tokens, and everysupports_*flag as nulllitellm.get_model_info("cohere_chat/north-large-01-2026")gets "This model isn't mapped yet"After: the deployment reports Cohere's limits and features, with the price unset
north-largewithmodel: cohere_chat/north-large-01-2026and restarts the proxy"model": "north-large"and gets a 200 answermax_input_tokens: 256000,max_output_tokens: 65536, function calling and vision as true, and the price as nulllitellm.completion(model="north-large-01-2026")now works without thecohere_chat/prefixLinear ticket
Resolves LIT-8555
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
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 moreNo test is added, since the change is data only
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
Both legs ran against real Cohere, each a proxy with 2 uvicorn workers reading the cost map from its own commit (
LITELLM_LOCAL_MODEL_COST_MAP=True)63c3b7a34e360fc17d00/v1/model/infolimits/v1/model/infoflags/model_group/infoflagsget_model_infoConfig, proxy command, and helper scripts, the same for both legs
Config used by both legs (
north-large-pricedstands for an admin who sets their contract price)LITELLM_LOCAL_MODEL_COST_MAP=True python litellm/proxy/proxy_cli.py --config config.yaml --port $PORT --num_workers 2Each model info call is piped through a short filter that keeps the fields that matter here.
info_fields.pyfor/v1/model/infogroup_fields.pyfor/model_group/infosdk_check.pyBefore (63c3b7a)
/v1/model/infoList the deployments' model info, every limit and flag null
/model_group/infoRead the `north-large` model group
/v1/chat/completions, unpricedSteps and output
Send a chat request to
north-large/v1/chat/completions, pricedSteps and output
Send a chat request to
north-large-priced/v1/responses, pricedSteps and output
Send a Responses API request to
north-large-priced/v1/messages, pricedSteps and output
Send an Anthropic Messages request to
north-large-pricedSDK
Steps and output
Run the SDK script
After (360fc17)
/v1/model/infoList the deployments' model info
/model_group/infoRead the `north-large` model group
/v1/chat/completions, unpricedSteps and output
Send a chat request to
north-large/v1/chat/completions, pricedSteps and output
Send a chat request to
north-large-priced/v1/responses, pricedSteps and output
Send a Responses API request to
north-large-priced/v1/messages, pricedSteps and output
Send an Anthropic Messages request to
north-large-pricedTool call and image input, the two flags set true
Steps and output from a second proxy at 360fc17 on port 51973, each response filtered to the tool calls or the text
Send a chat request with a
get_weathertool tonorth-largeSend a chat request with a solid red image to
north-largeSDK
Steps and output
Run the SDK script
/live-pr-risk
Two breaking changes, for OTPM-limited deployments and near-limit prompts under pre-call checks, and four side effects nobody asked for, waiting on Mateo's acknowledgment on LIT-8555
Base
63c3b7a34eand headcb56aae1b6, each a proxy with 2 uvicorn workers, its own Postgres 16, and a forwarding recorder in front of api.cohere.com, both withLITELLM_LOCAL_MODEL_COST_MAP=Trueand the same config: acohere/north-large-01-2026deployment, acohere_chat/north-large-01-2026deployment, acohere_chat/*wildcard,modify_params: true, andenable_pre_call_checks: true. The flag change in954ddd95ddwas checked again live on both trees, where/model_group/inforeports no reasoning levels and/healthpasses.360fc17d00only unsetssupports_tool_choice, so every reader of that flag sees what it saw at the merge base, and/v1/model/infoshows it null liveBreaking
otpmunder 65536 andenforce_model_rate_limitsnow answers 429 to requests withoutmax_tokens, where the merge base answered 200 (live SDK Router run against real Cohere withotpm: 50000). With a higherotpm, onlyotpm / 65536such requests fit at once, so 2 concurrent requests atotpm: 100000got one 429. The check reserves the mapped max output, and command-a-plus-05-2026 429s the same way on base, so the check itself predates this PR. Shipping it waits on Mateo's acknowledgment on LIT-8555enable_pre_call_checks, a prompt Cohere bills as 251311 tokens now answers 400 ContextWindowExceededError (Got=263430) where the merge base answered 200, since the check counts with the OpenAI tokenizer, about 5% above Cohere's (live SDK Router, caveats round 4). Every mapped Cohere chat model has this band under its limit, and the check's fix is tracked separately. Shipping it waits on Mateo's acknowledgment on LIT-8555Every rig scenario that answered 200 on base answers 200 on head with the same body shape
Backward incompatible
cohere/north-large-01-2026now logs spend ascohere_chatinstead ofcohere, and aprovider_budget_configentry forcoherestops covering it (S1 and S8). Every mapped Cohere chat model gets this relabel.azure/north-large-01-2026likewise moves from/openai/deployments/north-large-01-2026/chat/completionswith anapi-keyheader to/chat/completionson the OpenAI client (SDK against a local request recorder). Shipping it waits on Mateo's acknowledgment on LIT-8555/healthon acohere_chat/*wildcard probes the 3 cheapest Cohere chat models with fallbacks. The new entry has no price, so it ties at $0 with command-a-plus-05-2026 and set order puts it first in most processes. A failed first probe falls back to a model that answers (live, both trees). The MCP sampling model picker reads the missing price the same way (traced). Shipping it waits on Mateo's acknowledgment on LIT-8555max_tokensup to 65536 instead of capping at 16384, so a nearly spent budget can refuse a request it admitted before. Traced, not run live. Shipping it waits on Mateo's acknowledgment on LIT-8555completion_costfor the model returns 0.0 where it raisedModelNotMappedError, as for every unpriced entry. Shipping it waits on Mateo's acknowledgment on LIT-8555Intended effects of mapping the model
modify_params: truewithmax_tokens: 100000on chat and/v1/messages. Base gets a 400 from Cohere (TOO_MANY_TOKENS), head answers 200 with 65536 sent on the wireenable_pre_call_checkswith a 272120-token prompt. Both return 400 ContextWindowExceededError, but base uploads 1.6 MB to Cohere first and head rejects it before any upstream callcohere_chat/*wildcard listscohere_chat/north-large-01-2026on/v1/models(8 ids become 9)x-litellm-response-cost-original: 0.0on both sidesRegression risk
/healthprobe and then pass on a fallback model. Not exercised, since the only key available can call the modelDependency graph
cohere/prefixazure/prefixmodify_paramsmax_tokens clip/v1/models/healthprobe/model/info,/model_group/infotrim_messages, bare namecoheresupports_tool_choicereadersNot verified
azure/north-large-01-2026against a real Azure OpenAI deployment with that name. Only the outbound request was recorded, since no such deployment is availabletrim_messageswith the bare name now trims to 0.75 x 256000 tokens. SDK only, not driven12 map-wide and Cohere unit test files pass on head except 7 tests that fail the same way at the merge base (responses SDK retries and auto router trace provenance). main is 5 commits past the merge base with none in these paths, and the PR merges cleanly
Type
🆕 New Feature
Decisions
Price, limits, and capabilities
Price. Cohere publishes no per-token price for north models, so the entry has no cost keys. An explicit
0.0would show in/model/infoand the Admin UI as a real $0 price, and leaving the model out keeps its limits unknown. With no key,/model/infoshows a null price, and a deployment that sets its contract price gets cost from Cohere's reportedtokens(see Caveats). Proxy spend for an unpriced deployment stays $0 as on main. In the SDK,response_costmoves fromNoneto0.0andcompletion_costreturns0.0where it raised, like every other unpriced entry, so an SDK caller cannot tell this model from a free one unless it sets a price. The ticket asked for no $0 price, and the entry carries noneLimits.
max_input_tokensis Cohere'scontext_length(256000).max_output_tokensandmax_tokensare 65536, the cap Cohere's v2 chat error names ("max tokens must be less than or equal to 65536, the maximum output length for this model"), since no Cohere page publishes itCapabilities. The entry sets only what the
cohere_chatroute honors today,supports_function_callingandsupports_vision, each sent live in the After leg. Cohere's features list also hasreasoningandjson_schema, but the route rejectsreasoning_effortandresponse_format, so those flags stay unset until it maps them.supports_tool_choicestays unset too, because Cohere answers 400 "tool_choice is not supported for this model" when sent it directly, and the route drops it before sending, sotool_choice: "none"through LiteLLM still returned a tool callCaveats (if any)
Severe
otpmnow 429 requests that omitmax_tokensotpm / 65536fit at oncemax_tokensavoids itHigh
enable_pre_call_checks, near-limit prompts Cohere accepts now get a 400azure/north-large-01-2026now goes to the OpenAI client instead of Azurecohere/north-large-01-2026now logs spend ascohere_chat, outside acoherebudgetcompletion_costreturns 0.0 where it raisedModelNotMappedError/healthand the MCP sampling picker treat it as cheapestMedium
max_tokensup to 65536, not 16384Low
Evidence, and why each stays unfixed
Severe. A live SDK Router against real Cohere with
otpm: 50000andenforce_model_rate_limitssent a request withoutmax_tokens. The merge base answered 200, and 360fc17 answered 429OTPM limit=50000, current usage=65536. With 2 concurrent requests atotpm100000 one gotcurrent usage=131072, and withmax_tokens: 2048it answers 200. Mapping the real max output is the point of this PR, so the fix belongs to the OTPM check and is tracked separately. Shipping it waits on Mateo's acknowledgment on LIT-8555High, pre-call. The check counts with the OpenAI tokenizer, about 5% above Cohere's on English text. A Router with
enable_pre_call_checkssent a prompt Cohere bills as 251311 tokens. The merge base answered 200, and the tip answered 400Max Input Tokens=256000, Got=263430before any upstream call. Every mapped Cohere chat model has this band, and the check's fix is tracked separately. Shipping it waits on Mateo's acknowledgment on LIT-8555High, azure.
litellm.completion(model="azure/north-large-01-2026")against a local request recorder sent/openai/deployments/north-large-01-2026/chat/completionswith anapi-keyheader at the merge base, and/chat/completionswith a Bearer token at the tip. Every mapped Cohere chat model takes this route, and no real Azure OpenAI deployment with this name was available to drive. Shipping it waits on Mateo's acknowledgment on LIT-8555High, cohere/.
cohere/north-large-01-2026givescohereat the base andcohere_chathere, as for every mapped Cohere chat model (tests/unit/litellm_core_utils/test_get_llm_provider_logic.py). The upstream request does not change. Shipping it waits on Mateo's acknowledgment on LIT-8555High, SDK cost.
cost_per_tokenreturns (0.0, 0.0) the same way. The entry has no price on purpose, since Cohere publishes none, and every unpriced entry returns 0.0. Shipping it waits on Mateo's acknowledgment on LIT-8555High, picker. Both pickers read a missing price as 0, so wildcard
/healthnow probes north-large among its 3 models. A key without access to it fails that probe and falls back to the next model, which answered on both trees. Every proxy version reads main's cost map, so a picker fix here would not reach them. Shipping it waits on Mateo's acknowledgment on LIT-8555Medium, spend. Cohere publishes no per-token price, so the entry carries none instead of a made-up $0, and
/model/infoshows null. The proof's priced rows show cost once the admin sets a price. Key and team budgets do not go down for an unpriced deployment, as on mainMedium, reservations. A nearly spent budget can now refuse a large
max_tokensrequest it admitted before. Traced, not run. It follows from the mapped max output, so a fix here would undo the PRMedium, tool calling. Turn 2 fails with 422
parameter 'index' is not a valid fieldbecause litellm replays a synthetic tool callindex. It predates this PR, and #41332 is the open fix. Single-turn tool calls answer, as the After leg showsMedium, cost. Cohere reports 1312
tokensand 8billed_unitsfor the proof prompt, and LiteLLM pricestokensfor every Cohere chat model. Fixing it changes usage and cost for all of them, so it is tracked separatelyLow, rig.
954ddd95ddand360fc17d00only remove flags. Every reader of those flags was checked live at the tip (/model_group/info,/health,/v1/model/info), so a full rig run would repeat what those checks showFixed in 954ddd9 and 360fc17.
supports_reasoning,supports_response_schema, andsupports_tool_choiceare now unset, since the route rejectsreasoning_effortandresponse_format, and Cohere answers 400 totool_choiceon this modelFinal 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
360fc17 passes /live-pr-risk
Note
Medium Risk
Data-only change, but exposing a 65536 max output can tighten OTPM and budget pre-checks for deployments without
max_tokens, and mapped Cohere chat models can shift provider labeling and cheapest-model probe order.Overview
Registers Cohere
north-large-01-2026inmodel_prices_and_context_window.jsonand its backup so LiteLLM can resolve the model forcohere_chatrouting, SDK lookups, and proxy/v1/model/info.The new entry sets 256k input and 65536 max output tokens, marks function calling and vision, and omits per-token pricing so costs stay null unless a deployment overrides them. Downstream behavior that reads the cost map (pre-call context checks,
modify_paramsclipping, OTPM reservation, wildcard health/MCP pickers) will start using these limits instead of treating the model as unmapped.Reviewed by Cursor Bugbot for commit 360fc17. Bugbot is set up for automated code reviews on this repo. Configure here.