Skip to content

feat(openrouter): add stealth/union-alpha to the model cost map - #41576

Merged
kerry-berri merged 1 commit into
mainfrom
litellm_openrouter_union_alpha
Sep 17, 2026
Merged

kerry-berri merged 1 commit into
mainfrom
litellm_openrouter_union_alpha

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • OpenRouter's new stealth model stealth/union-alpha is missing from the cost map
  • Calls work today but cost tracking and capability lookups have no entry for it

How it solves it:

  • Adds openrouter/stealth/union-alpha to the cost map and its backup copy
  • Values come from GET https://openrouter.ai/api/v1/models: 262,144 context, 131,072 max completion tokens, $0 in/out, text+image input, tools, tool_choice, response_format

User Flow

Before: a developer routing to Union Alpha through the gateway gets a working answer but the model is unknown to the gateway

  1. The proxy admin adds a deployment with model: openrouter/stealth/union-alpha and an OPENROUTER_API_KEY
  2. The developer sends POST https://litellm-domain/v1/chat/completions with "model": "union-alpha" and gets a 200 with a normal completion
  3. GET https://litellm-domain/model/info shows the deployment with max_input_tokens: null, supports_vision: null and supports_function_calling: null, and SDK users calling completion_cost on the response get This model isn't mapped yet

After: the same request is priced and described

  1. The proxy admin adds the same deployment
  2. The developer sends the same POST https://litellm-domain/v1/chat/completions and gets the same 200
  3. GET https://litellm-domain/model/info now reports max_input_tokens: 262144, max_output_tokens: 131072, supports_vision: true, supports_function_calling: true and $0 pricing, and completion_cost returns 0.0

Relevant issues

Affected release

Linear ticket

Resolves LIT-7988

Closes LIT-7988

Pre-Submission checklist

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

  • I have added meaningful tests (data-only change, covered by the existing cost map schema tests)
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<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 (no test file touched; verified via live proxy below)
  • 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
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

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

Live calls against OpenRouter with a real key, through both the SDK and a running proxy. Before runs on a worktree at the merge base (port 4001), After runs on the PR tip (port 4000), both started with LITELLM_LOCAL_MODEL_COST_MAP=True python litellm/proxy/proxy_cli.py --config config.yaml where config.yaml has one deployment, model_name: union-alpha -> model: openrouter/stealth/union-alpha

Source row, fetched with curl -s https://openrouter.ai/api/v1/models on 2026-09-17:

id: stealth/union-alpha
context_length: 262144
top_provider.max_completion_tokens: 131072
pricing: prompt 0, completion 0
architecture.input_modalities: text, image
supported_parameters: max_tokens, response_format, temperature, tool_choice, tools, top_p

Commands (run once per port):

curl -s http://localhost:$PORT/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
  -d '{"model":"union-alpha","messages":[{"role":"user","content":"Reply with exactly: union alpha ok"}],"max_tokens":20}'
curl -s http://localhost:$PORT/model/info -H "Authorization: Bearer sk-1234"

Before (merge base, port 4001)

{"id":"gen-1789629942-sBM8JGOMapIjGxBOj26f","model":"union-alpha","choices":[{"finish_reason":"stop","message":{"content":"union alpha ok","role":"assistant"}}],"usage":{"completion_tokens":7,"prompt_tokens":6,"total_tokens":13},"provider":"Stealth"}

model_info: {'max_input_tokens': None, 'max_output_tokens': None, 'input_cost_per_token': 0, 'output_cost_per_token': 0, 'supports_vision': None, 'supports_function_calling': None, 'supports_response_schema': None}

SDK at the merge base, litellm.completion(model='openrouter/stealth/union-alpha', ...) returns union alpha ok but litellm.completion_cost(completion_response=r) raises ValueError: This model isn't mapped yet. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json

After (3d0fd12, port 4000)

{"id":"gen-1789630010-JMbKbJjhd4Hy2ykz8DZV","model":"union-alpha","choices":[{"finish_reason":"stop","message":{"content":"union alpha ok","role":"assistant"}}],"usage":{"completion_tokens":7,"prompt_tokens":24,"total_tokens":31},"provider":"Stealth"}

model_info: {'max_input_tokens': 262144, 'max_output_tokens': 131072, 'input_cost_per_token': 0, 'output_cost_per_token': 0, 'supports_vision': True, 'supports_function_calling': True, 'supports_response_schema': True}

SDK at the PR tip, same litellm.completion call returns union alpha ok with usage 24/7 and litellm.completion_cost(completion_response=r) returns 0.0

Type

New Feature

Caveats (if any)

Low

  • Stealth model: OpenRouter may rename or remove it after the preview
  • Pricing is $0 during the preview; a later paid price will need a follow-up

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

Link to Devin session: https://app.devin.ai/sessions/1bb1affe356b4dd795450e529e2cff25
Open in Devin Desktop: https://app.devin.ai/desktop/session/1bb1affe356b4dd795450e529e2cff25?variant=devin

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot requested a review from a team September 17, 2026 07:21
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@kerry-berri

Copy link
Copy Markdown
Contributor

@greptileai

@kerry-berri

Copy link
Copy Markdown
Contributor

bugbot run

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge because both cost maps remain synchronized and the new metadata follows existing conventions

Summary

Adds metadata for OpenRouter's stealth/union-alpha model to both synchronized cost maps

  • Records input and output token limits and zero-cost preview pricing
  • Declares vision, function calling, tool choice, and response schema support
  • Keeps the primary and packaged backup maps synchronized

Reviews (1) · Last reviewed commit: "feat(openrouter): add stealth/union-alph..."

@codspeed

codspeed Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_openrouter_union_alpha (3d0fd12) with main (d8d5437)

Open in CodSpeed

@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 3d0fd12. Configure here.

@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

lgtm

@kerry-berri
kerry-berri merged commit 4b368bf into main Sep 17, 2026
89 checks passed
@kerry-berri
kerry-berri deleted the litellm_openrouter_union_alpha branch September 17, 2026 07:37
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.

2 participants