Skip to content

feat(cost-map): add Cohere north-large-01-2026 with its context window and capabilities - #46589

Closed
mateo-berri wants to merge 3 commits into
mainfrom
litellm_cohere_north_large_cost_map
Closed

mateo-berri wants to merge 3 commits into
mainfrom
litellm_cohere_north_large_cost_map

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • north-large-01-2026 is missing from the cost map
  • So /model/info and the SDK know nothing about its limits or capabilities

How it solves it:

  • Adds Cohere's own limits, 256000 context and 65536 output
  • Flags cover what the cohere_chat route honors, function calling and vision
  • No price, since Cohere publishes none, so /model/info shows null, not $0

User Flow

Before: requests answer, but LiteLLM knows nothing about the model's limits or features

  1. The admin adds a deployment north-large with model: cohere_chat/north-large-01-2026 and restarts the proxy
  2. A developer sends POST https://litellm-domain/v1/chat/completions with "model": "north-large" and gets a 200 answer
  3. GET https://litellm-domain/v1/model/info shows max_input_tokens, max_output_tokens, and every supports_* flag as null
  4. An SDK user calling litellm.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

  1. The admin adds a deployment north-large with model: cohere_chat/north-large-01-2026 and restarts the proxy
  2. A developer sends POST https://litellm-domain/v1/chat/completions with "model": "north-large" and gets a 200 answer
  3. GET https://litellm-domain/v1/model/info shows max_input_tokens: 256000, max_output_tokens: 65536, function calling and vision as true, and the price as null
  4. The SDK call returns the same limits, and litellm.completion(model="north-large-01-2026") now works without the cohere_chat/ prefix

Linear ticket

Resolves LIT-8555

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

No 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)

Case Before 63c3b7a34e After 360fc17d00
/v1/model/info limits null 256000 / 65536
/v1/model/info flags null function calling, vision true
/model_group/info flags false function calling, vision true
Unpriced chat cost 0.0 0.0
Priced cost, 3 endpoints set price x usage set price x usage
SDK get_model_info not mapped 256000 / 65536
SDK bare model name error answers
Config, proxy command, and helper scripts, the same for both legs

Config used by both legs (north-large-priced stands for an admin who sets their contract price)

model_list:
  - model_name: north-large
    litellm_params:
      model: cohere_chat/north-large-01-2026
      api_key: os.environ/COHERE_API_KEY
  - model_name: north-large-priced
    litellm_params:
      model: cohere_chat/north-large-01-2026
      api_key: os.environ/COHERE_API_KEY
      input_cost_per_token: 0.000001
      output_cost_per_token: 0.000002
LITELLM_LOCAL_MODEL_COST_MAP=True python litellm/proxy/proxy_cli.py --config config.yaml --port $PORT --num_workers 2

Each model info call is piped through a short filter that keeps the fields that matter here. info_fields.py for /v1/model/info

import json,sys
for d in json.load(sys.stdin)["data"]:
    mi=d["model_info"]; print(d["model_name"], json.dumps({k:mi.get(k) for k in ["max_input_tokens","max_output_tokens","input_cost_per_token","output_cost_per_token","supports_function_calling","supports_tool_choice","supports_reasoning","supports_response_schema","supports_vision"]}))

group_fields.py for /model_group/info

import json,sys
for d in json.load(sys.stdin)["data"]:
    print(d["model_group"], json.dumps({k:d.get(k) for k in ["max_input_tokens","max_output_tokens","input_cost_per_token","output_cost_per_token","supports_function_calling","supports_reasoning","supports_vision"]}))

sdk_check.py

import litellm

for name in ("cohere_chat/north-large-01-2026", "north-large-01-2026"):
    try:
        info = litellm.get_model_info(name)
        print(name, "->", info["litellm_provider"], info["max_input_tokens"], info["max_output_tokens"])
    except Exception as e:
        print(name, "->", type(e).__name__, str(e).splitlines()[0][:120])

try:
    r = litellm.completion(
        model="north-large-01-2026",
        messages=[{"role": "user", "content": "Name one Canadian province. One word."}],
    )
    print("completion(model='north-large-01-2026') ->", r.choices[0].message.content)
except Exception as e:
    print("completion(model='north-large-01-2026') ->", type(e).__name__, str(e).splitlines()[0][:120])

Before (63c3b7a)

/v1/model/info

List the deployments' model info, every limit and flag null
$ curl -s http://127.0.0.1:43483/v1/model/info -H "Authorization: Bearer $LITELLM_MASTER_KEY" | python3 info_fields.py
north-large {"max_input_tokens": null, "max_output_tokens": null, "input_cost_per_token": null, "output_cost_per_token": null, "supports_function_calling": null, "supports_tool_choice": null, "supports_reasoning": null, "supports_response_schema": null, "supports_vision": null}
north-large-priced {"max_input_tokens": null, "max_output_tokens": null, "input_cost_per_token": 1e-06, "output_cost_per_token": 2e-06, "supports_function_calling": null, "supports_tool_choice": null, "supports_reasoning": null, "supports_response_schema": null, "supports_vision": null}

/model_group/info

Read the `north-large` model group
$ curl -s "http://127.0.0.1:43483/model_group/info?model_group=north-large" -H "Authorization: Bearer $LITELLM_MASTER_KEY" | python3 group_fields.py
north-large {"max_input_tokens": null, "max_output_tokens": null, "input_cost_per_token": null, "output_cost_per_token": null, "supports_function_calling": false, "supports_reasoning": false, "supports_vision": false}

/v1/chat/completions, unpriced

Steps and output
  1. Send a chat request to north-large

    $ curl -sD - http://127.0.0.1:43483/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large","messages":[{"role":"user","content":"Name one Canadian province. One word."}]}'
    HTTP/1.1 200 OK
    x-litellm-response-cost-original: 0.0
    {"id":"chatcmpl-df457f7b-b3f4-4dd4-b586-0a2686d97334","created":1792030934,"model":"north-large","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Ontario","role":"assistant"}}],"usage":{"completion_tokens":305,"prompt_tokens":1312,"total_tokens":1617}}
    

/v1/chat/completions, priced

Steps and output
  1. Send a chat request to north-large-priced

    $ curl -sD - http://127.0.0.1:43483/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large-priced","messages":[{"role":"user","content":"Name one Canadian province. One word."}]}'
    HTTP/1.1 200 OK
    x-litellm-response-cost: 0.0017079999999999999
    x-litellm-response-cost-original: 0.0017079999999999999
    {"id":"chatcmpl-436c75c3-19fa-4515-bd5e-b9c5ca049e95","created":1792030936,"model":"north-large-priced","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Ontario","role":"assistant"}}],"usage":{"completion_tokens":198,"prompt_tokens":1312,"total_tokens":1510}}
    

/v1/responses, priced

Steps and output
  1. Send a Responses API request to north-large-priced

    $ curl -sD - http://127.0.0.1:43483/v1/responses -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large-priced","input":"Name one Canadian province. One word."}'
    HTTP/1.1 200 OK
    x-litellm-response-cost: 0.001494
    x-litellm-response-cost-original: 0.001494
    {"id":"resp_DITvbFpKKoOyZiTXaFuZIdj8zQBma6YXsbmEElSLZ-dDoEMtffBaU8CQb5EPJPTeunHm1_9TVP7XVLyJvLZp0W_yzaCYf5mHOaiqkU5mde2tstKpnaFRch4d25us-ixyMieh88qahq12_2CgM3TbnFp8mWtV9EDiW96yIutUfMwKoq9H9E6PE7SdLDveFw1RsozsQGuOWY0z8pvp8Jgow9kv2mHBbMVP10-bgJ4LF2cUlgxwgryDa7CqwtV-2ZYgCMCXPPnpB6knlMnUYpFQ0WxnrYHGDh2F
    

/v1/messages, priced

Steps and output
  1. Send an Anthropic Messages request to north-large-priced

    $ curl -sD - http://127.0.0.1:43483/v1/messages -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large-priced","max_tokens":2048,"messages":[{"role":"user","content":"Name one Canadian province. One word."}]}'
    HTTP/1.1 200 OK
    x-litellm-response-cost: 0.00191
    x-litellm-response-cost-original: 0.00191
    {"id":"chatcmpl-ce9569e1-39cd-48e0-a722-78b65b734784","type":"message","role":"assistant","model":"north-large-priced","stop_sequence":null,"usage":{"input_tokens":1312,"output_tokens":299},"content":[{"type":"text","text":"Ontario"}],"stop_reason":"end_turn","stop_details":null}
    

SDK

Steps and output
  1. Run the SDK script

    $ LITELLM_LOCAL_MODEL_COST_MAP=True python sdk_check.py
    cohere_chat/north-large-01-2026 -> ModelNotMappedError This model isn't mapped yet. model=cohere_chat/north-large-01-2026, custom_llm_provider=cohere_chat. Add it here - https
    north-large-01-2026 -> ModelNotMappedError This model isn't mapped yet. model=north-large-01-2026, custom_llm_provider=None. Add it here - https://github.com/Berri
    completion(model='north-large-01-2026') -> BadRequestError litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=no
    

After (360fc17)

/v1/model/info

  1. List the deployments' model info

    $ curl -s http://127.0.0.1:47263/v1/model/info -H "Authorization: Bearer $LITELLM_MASTER_KEY" | python3 info_fields.py
    north-large {"max_input_tokens": 256000, "max_output_tokens": 65536, "input_cost_per_token": null, "output_cost_per_token": null, "supports_function_calling": true, "supports_tool_choice": null, "supports_reasoning": null, "supports_response_schema": null, "supports_vision": true}
    north-large-priced {"max_input_tokens": 256000, "max_output_tokens": 65536, "input_cost_per_token": 1e-06, "output_cost_per_token": 2e-06, "supports_function_calling": true, "supports_tool_choice": null, "supports_reasoning": null, "supports_response_schema": null, "supports_vision": true}
    

/model_group/info

Read the `north-large` model group
$ curl -s "http://127.0.0.1:47263/model_group/info?model_group=north-large" -H "Authorization: Bearer $LITELLM_MASTER_KEY" | python3 group_fields.py
north-large {"max_input_tokens": 256000.0, "max_output_tokens": 65536.0, "input_cost_per_token": null, "output_cost_per_token": null, "supports_function_calling": true, "supports_reasoning": false, "supports_vision": true}

/v1/chat/completions, unpriced

Steps and output
  1. Send a chat request to north-large

    $ curl -sD - http://127.0.0.1:47263/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large","messages":[{"role":"user","content":"Name one Canadian province. One word."}]}'
    HTTP/1.1 200 OK
    x-litellm-response-cost-original: 0.0
    {"id":"chatcmpl-dbc3dc1d-df39-4203-a8d1-7874a7bc47a8","created":1792035914,"model":"north-large","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Ontario","role":"assistant"}}],"usage":{"completion_tokens":137,"prompt_tokens":1312,"total_tokens":1449}}
    

/v1/chat/completions, priced

Steps and output
  1. Send a chat request to north-large-priced

    $ curl -sD - http://127.0.0.1:47263/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large-priced","messages":[{"role":"user","content":"Name one Canadian province. One word."}]}'
    HTTP/1.1 200 OK
    x-litellm-response-cost: 0.001888
    x-litellm-response-cost-original: 0.001888
    {"id":"chatcmpl-d6a0eaf4-f4dd-4e3a-aaa9-a7b59859add6","created":1792035915,"model":"north-large-priced","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Ontario","role":"assistant"}}],"usage":{"completion_tokens":288,"prompt_tokens":1312,"total_tokens":1600}}
    

/v1/responses, priced

Steps and output
  1. Send a Responses API request to north-large-priced

    $ curl -sD - http://127.0.0.1:47263/v1/responses -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large-priced","input":"Name one Canadian province. One word."}'
    HTTP/1.1 200 OK
    x-litellm-response-cost: 0.001676
    x-litellm-response-cost-original: 0.001676
    {"id":"resp_yV0v2PNd7rlJTbkl25gWD7AMJAKT7y5Tir-jmOZrbnfVeHWjiizUeVOFPhCqAikbQkjFLFpshSXPMydZ42ZmrKR_HEKAcOIA6CN64IaVk-h2YJCcy9GS0cvmtHJqiN_X9Sd0pzeJnFzw_UGw2mEs2LI4s76HkWRP_FhlVsRKy3wJDzCFzoRovBTENhN0ITpOXPpluZpnBM7-YT-WODsrSuoP2dnUd0KWUetpPUgDxghGk8GYcrV3JXlXbjqJcift-fzW4BzUIR1Eskrp5gY0KJI9tI8YT-JO
    

/v1/messages, priced

Steps and output
  1. Send an Anthropic Messages request to north-large-priced

    $ curl -sD - http://127.0.0.1:47263/v1/messages -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large-priced","max_tokens":2048,"messages":[{"role":"user","content":"Name one Canadian province. One word."}]}'
    HTTP/1.1 200 OK
    x-litellm-response-cost: 0.001614
    x-litellm-response-cost-original: 0.001614
    {"id":"chatcmpl-4dac2399-7e5a-45f2-ae32-d4d0370e4130","type":"message","role":"assistant","model":"north-large-priced","stop_sequence":null,"usage":{"input_tokens":1312,"output_tokens":151},"content":[{"type":"text","text":"Ontario"}],"stop_reason":"end_turn","stop_details":null}
    

Tool 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
  1. Send a chat request with a get_weather tool to north-large

    $ curl -s http://127.0.0.1:51973/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large","messages":[{"role":"user","content":"What is the weather in Toronto?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the current weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]}'
    {"finish_reason": "stop", "tool_calls": [{"name": "get_weather", "arguments": "{\"city\":\"Toronto\"}"}]}
    
  2. Send a chat request with a solid red image to north-large

    $ curl -s http://127.0.0.1:51973/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"north-large","max_tokens":2048,"messages":[{"role":"user","content":[{"type":"text","text":"What single color fills this image? One word."},{"type":"image_url","image_url":{"url":"data:image/png;base64,<a 64x64 solid red PNG>"}}]}]}'
    {"content": "Red"}
    

SDK

Steps and output
  1. Run the SDK script

    $ LITELLM_LOCAL_MODEL_COST_MAP=True python sdk_check.py
    cohere_chat/north-large-01-2026 -> cohere_chat 256000 65536
    north-large-01-2026 -> cohere_chat 256000 65536
    completion(model='north-large-01-2026') -> Ontario
    

/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 63c3b7a34e and head cb56aae1b6, each a proxy with 2 uvicorn workers, its own Postgres 16, and a forwarding recorder in front of api.cohere.com, both with LITELLM_LOCAL_MODEL_COST_MAP=True and the same config: a cohere/north-large-01-2026 deployment, a cohere_chat/north-large-01-2026 deployment, a cohere_chat/* wildcard, modify_params: true, and enable_pre_call_checks: true. The flag change in 954ddd95dd was checked again live on both trees, where /model_group/info reports no reasoning levels and /health passes. 360fc17d00 only unsets supports_tool_choice, so every reader of that flag sees what it saw at the merge base, and /v1/model/info shows it null live

Breaking

  • A north-large deployment with otpm under 65536 and enforce_model_rate_limits now answers 429 to requests without max_tokens, where the merge base answered 200 (live SDK Router run against real Cohere with otpm: 50000). With a higher otpm, only otpm / 65536 such requests fit at once, so 2 concurrent requests at otpm: 100000 got 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-8555
  • With enable_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-8555

Every rig scenario that answered 200 on base answers 200 on head with the same body shape

Backward incompatible

  • A deployment written as cohere/north-large-01-2026 now logs spend as cohere_chat instead of cohere, and a provider_budget_config entry for cohere stops covering it (S1 and S8). Every mapped Cohere chat model gets this relabel. azure/north-large-01-2026 likewise moves from /openai/deployments/north-large-01-2026/chat/completions with an api-key header to /chat/completions on the OpenAI client (SDK against a local request recorder). Shipping it waits on Mateo's acknowledgment on LIT-8555
  • /health on a cohere_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-8555
  • A priced deployment's budget reservation now honors max_tokens up 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-8555
  • SDK completion_cost for the model returns 0.0 where it raised ModelNotMappedError, as for every unpriced entry. Shipping it waits on Mateo's acknowledgment on LIT-8555

Intended effects of mapping the model

  • modify_params: true with max_tokens: 100000 on chat and /v1/messages. Base gets a 400 from Cohere (TOO_MANY_TOKENS), head answers 200 with 65536 sent on the wire
  • enable_pre_call_checks with a 272120-token prompt. Both return 400 ContextWindowExceededError, but base uploads 1.6 MB to Cohere first and head rejects it before any upstream call
  • The cohere_chat/* wildcard lists cohere_chat/north-large-01-2026 on /v1/models (8 ids become 9)
  • Wildcard chat cost stays a $0 spend row with x-litellm-response-cost-original: 0.0 on both sides

Regression risk

  • A Cohere key without access to north-large-01-2026 would fail the first wildcard /health probe and then pass on a fallback model. Not exercised, since the only key available can call the model

Dependency graph

Dependent State
Provider inference, cohere/ prefix verified live
Provider inference, bare name verified live
Provider inference, azure/ prefix recorder only
Cost calculation, SDK and proxy verified live
Router pre-call context check verified live
modify_params max_tokens clip verified live
Wildcard /v1/models verified live
Wildcard /health probe verified live
/model/info, /model_group/info verified live
trim_messages, bare name untested
Cohere param mapping unchanged
Deployment OTPM check verified live (SDK)
Provider budgets keyed on cohere traced
Budget reservation traced
Admin UI reasoning level picker verified live
MCP sampling model picker traced
supports_tool_choice readers as on base

Not verified

  • azure/north-large-01-2026 against a real Azure OpenAI deployment with that name. Only the outbound request was recorded, since no such deployment is available
  • trim_messages with the bare name now trims to 0.75 x 256000 tokens. SDK only, not driven

12 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

  • 360fc17 passes /audit (skipped: a cost-map entry)

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.0 would show in /model/info and the Admin UI as a real $0 price, and leaving the model out keeps its limits unknown. With no key, /model/info shows a null price, and a deployment that sets its contract price gets cost from Cohere's reported tokens (see Caveats). Proxy spend for an unpriced deployment stays $0 as on main. In the SDK, response_cost moves from None to 0.0 and completion_cost returns 0.0 where 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 none

Limits. max_input_tokens is Cohere's context_length (256000). max_output_tokens and max_tokens are 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 it

Capabilities. The entry sets only what the cohere_chat route honors today, supports_function_calling and supports_vision, each sent live in the After leg. Cohere's features list also has reasoning and json_schema, but the route rejects reasoning_effort and response_format, so those flags stay unset until it maps them. supports_tool_choice stays 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, so tool_choice: "none" through LiteLLM still returned a tool call

Caveats (if any)

Severe

  • North-large deployments with otpm now 429 requests that omit max_tokens
    • Each reserves 65536 output tokens instead of 4096
    • Under 65536 all fail, and above it only otpm / 65536 fit at once
    • Every version gets it at its next restart after merge. Sending max_tokens avoids it

High

  • With enable_pre_call_checks, near-limit prompts Cohere accepts now get a 400
  • azure/north-large-01-2026 now goes to the OpenAI client instead of Azure
  • cohere/north-large-01-2026 now logs spend as cohere_chat, outside a cohere budget
  • SDK completion_cost returns 0.0 where it raised ModelNotMappedError
  • Wildcard /health and the MCP sampling picker treat it as cheapest

Medium

  • Spend stays $0 unless the admin sets a price
  • Priced budget reservations now honor max_tokens up to 65536, not 16384
  • Multi-turn tool calling fails on turn 2, for every Cohere chat model
  • Contract-priced cost counts 1312 prompt tokens where Cohere bills 8, as before

Low

  • The /live-pr-risk rig ran at cb56aae, before two flag-only commits
Evidence, and why each stays unfixed

Severe. A live SDK Router against real Cohere with otpm: 50000 and enforce_model_rate_limits sent a request without max_tokens. The merge base answered 200, and 360fc17 answered 429 OTPM limit=50000, current usage=65536. With 2 concurrent requests at otpm 100000 one got current usage=131072, and with max_tokens: 2048 it 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-8555

High, pre-call. The check counts with the OpenAI tokenizer, about 5% above Cohere's on English text. A Router with enable_pre_call_checks sent a prompt Cohere bills as 251311 tokens. The merge base answered 200, and the tip answered 400 Max Input Tokens=256000, Got=263430 before 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-8555

High, azure. litellm.completion(model="azure/north-large-01-2026") against a local request recorder sent /openai/deployments/north-large-01-2026/chat/completions with an api-key header at the merge base, and /chat/completions with 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-8555

High, cohere/. cohere/north-large-01-2026 gives cohere at the base and cohere_chat here, 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-8555

High, SDK cost. cost_per_token returns (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-8555

High, picker. Both pickers read a missing price as 0, so wildcard /health now 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-8555

Medium, spend. Cohere publishes no per-token price, so the entry carries none instead of a made-up $0, and /model/info shows 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 main

Medium, reservations. A nearly spent budget can now refuse a large max_tokens request it admitted before. Traced, not run. It follows from the mapped max output, so a fix here would undo the PR

Medium, tool calling. Turn 2 fails with 422 parameter 'index' is not a valid field because litellm replays a synthetic tool call index. It predates this PR, and #41332 is the open fix. Single-turn tool calls answer, as the After leg shows

Medium, cost. Cohere reports 1312 tokens and 8 billed_units for the proof prompt, and LiteLLM prices tokens for every Cohere chat model. Fixing it changes usage and cost for all of them, so it is tracked separately

Low, rig. 954ddd95dd and 360fc17d00 only 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 show

Fixed in 954ddd9 and 360fc17. supports_reasoning, supports_response_schema, and supports_tool_choice are now unset, since the route rejects reasoning_effort and response_format, and Cohere answers 400 to tool_choice on this model

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

  • 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-2026 in model_prices_and_context_window.json and its backup so LiteLLM can resolve the model for cohere_chat routing, 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_params clipping, 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.

@devin-ai-integration

devin-ai-integration Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository.

@codspeed

codspeed Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_cohere_north_large_cost_map (360fc17) with main (314f179)

Open in CodSpeed

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@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.

Stale Bugbot comment from a previous run.

@litereview

litereview Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

✅ code-review

5/5 · Ready for human review

Scope: full · Full PR review.

No correctness findings. The PR adds the same north-large-01-2026 cost-map entry to both the root map and the backup map. On head, get_model_info returns the stated limits and flags, and it resolves the bare model name to cohere_chat. The JSON schema test passes.

Checks and execution details
  • Passed · Real testing evidence (required): Not applicable: no LLM translation changes in the scoped paths. The diff changes only model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json, and neither file is under litellm/llms/** or prompt_templates/**.
  • Passed · Cost map JSON schema test (optional): pytest tests/unit/test_utils.py -k json_is_valid: 1 passed.
  • Passed · Root and backup maps identical (optional): json.load of both files gives equal dicts.
  • Passed · SDK model info on head (optional): With LITELLM_LOCAL_MODEL_COST_MAP=True, get_model_info('cohere_chat/north-large-01-2026') returns 256000 65536, input_cost_per_token 0, vision True and function calling True. get_llm_provider('north-large-01-2026') returns cohere_chat. The proxy at proxy_server.py:15030 shows null for unpriced entries.

View review · Reviewed 360fc17d0005

@codecov

codecov Bot commented Oct 15, 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

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@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.

Stale Bugbot comment from a previous run.

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

"supports_function_calling": true,
"supports_tool_choice": true
},
"north-large-01-2026": {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Medium · /model/info reports tool_choice as unsupported for north-large, contradicting the PR

  1. An admin deploys cohere_chat/north-large-01-2026, as in the PR's user flow.
  2. The admin or a client checks capabilities with GET /v1/model/info or litellm.get_model_info(...). A client can also call litellm.utils.supports_tool_choice(...).
  3. The new cost-map entry sets supports_function_calling and supports_vision, but has no supports_tool_choice key.
  4. get_model_info returns supports_tool_choice: None, and supports_tool_choice() returns False. 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 sending tool_choice will skip a feature the author confirmed works live. Every other function-calling cohere_chat entry 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Finding withdrawn

Thanks for clarifying. The finding rested on two points, and neither holds at head 360fc17d00.

  1. The PR body no longer contradicts the entry. The Decisions section now says supports_tool_choice is unset because the route drops tool_choice. The caveats list this as fixed in 360fc17d00. The old After proof showed true, but the current body no longer uses it.
  2. The flag would be false advertising. CohereChatConfig.map_openai_params and CohereV2ChatConfig.map_openai_params both list tool_choice as a supported param but never copy it into optional_params. I confirmed this on head: a tool_choice='none' request reaches Cohere without tool_choice. Setting supports_tool_choice: true would 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

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@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 360fc17. Configure here.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Absorbed north-large-01-2026 into #46742, keeping the verified 256K context and dropping the unpublished 65536 output limit, closing as superseded

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Update: north-large-01-2026 was also dropped from #46742, since an entry with no published price logs $0 spend instead of erroring

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.

1 participant