Repository navigation
feat(providers): add TopxAI as a JSON-configured OpenAI-compatible provider - #41919
UnbelievableT wants to merge 33 commits into
Conversation
…ovider TopxAI (https://ai.topxea.com) relays Claude, GPT, Grok, Kimi and a fine-tuned GLM through one OpenAI-compatible endpoint at fixed USD prices. This registers topxai/ in providers.json with the Responses API declared, adds the nine text models to the cost map with their cache lanes and the OpenAI and Grok whole-request long-context tiers, and registers the provider in the endpoint matrix and the dashboard.
Merging this PR will not alter performance1 warning
Comparing Footnotes |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@greptileai Please re-review the updated Responses tests, context boundaries, cache-write rates, source citations, and removal of the redundant provider comment. |
|
@greptileai Please re-review the supported Grok tier schema. Runtime boundary tests and the existing cost-map schema test now pass locally. |
|
Reproduced the Azure fallback failure on unmodified CI base 1259378: one failed, one passed. Exact dated catalog entry contradicts fallback expectation |
Conflicts resolved: - litellm/constants.py: keep upstream's new "sail" entry in openai_compatible_providers and add "topxai" after it. - litellm/llms/openai_like/providers.json: keep upstream's new "sail" provider and append "topxai" after it. - tests/test_litellm/llms/openai_like/test_topxai_provider.py: upstream moved tests/test_litellm/llms to tests/unit/llms (BerriAI#43191); the TopxAI test moves with it to tests/unit/llms/openai_like/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cing TopxAI retired claude-fable-5, claude-opus-5, gpt-5.6-sol and grok-4.6 on 2026-09-24; its API now answers 403 for them. Their topxai/* entries are removed, and topxai/claude-opus-5-5, topxai/gpt-6-sol and topxai/grok-4.7 take the places of their predecessors. topxai/deepseek-flash and topxai/deepseek-v4-pro are added. Every number comes from https://ai.topxea.com/api/pricing (2026-09-28), on the route the existing entries already used: the model's auto route, which is the shared pool where one exists (claude-shared, openai-shared, grok-shared) and otherwise its single official line (kimi-official, z-official, deepseek-official). - gpt-6-astra: max_input_tokens follows the catalogue's 1,050,000 context window (was 1,000,000). - Cache-write rates only where the catalogue publishes one. GLM and Grok publish none, so cache_creation_input_token_cost is dropped from GLM-5.3-Abliterated and not set on grok-4.7; an absent rate bills cache writes at the input rate, the value the removed field repeated. - grok-4.7 has no max_output_tokens: the catalogue lists no output limit. Its 200K tier keeps the inclusive boundary through tiered_pricing. - DeepSeek lists the peak lanes and an off_peak_pricing block with the weekday windows, the same shape as the upstream deepseek rows. Chinese public holidays, which TopxAI bills off-peak, cannot be expressed. Tests follow the current models and add DeepSeek peak/off-peak costs at pinned billing times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved: - litellm/constants.py: keep upstream's new "https://api.prisminference.com/v1" entry in openai_compatible_endpoints and add "https://ai.topxea.com/v1" after it. - litellm/types/utils.py: keep upstream's new LlmProviders.PRISM and add TOPXAI after it. The cost maps and the other provider registry files merged cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TopxAI retired gpt-6-sol on 2026-09-30 with no forwarding alias; requests for it now answer HTTP 403. topxai/gpt-6.1-sol takes the place of its entry in both cost maps. Prices are the openai-shared route that auto_route names in https://ai.topxea.com/api/pricing (2026-09-30), encoded the way the gpt-6-sol entry was: input 1e-06, output 5e-06, cache read 5e-08 (half of GPT-6 Sol's 1e-07), cache write 1.25e-06. Above 272,000 input tokens, cache tokens included, the whole request bills 2e-06 / 7.5e-06 / 1e-07 / 2.5e-06. Context 1,050,000 and output 128,000 tokens as the catalogue lists them; the capability flags are unchanged. The tests follow the new id. Their catalogue comments now cite 2026-09-30, when all ten entries were checked against /api/pricing again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TopxAI retired gpt-6-sol on 2026-09-30 with no forwarding alias; requests for it now answer HTTP 403. The model table and the streaming, Responses and proxy examples use topxai/gpt-6.1-sol, matching the cost map in BerriAI/litellm#41919. The Auto-route price stays at $1 input and $5 output per million tokens, with the whole-request $2 / $7.50 tier from 272,001 input tokens (https://ai.topxea.com/api/pricing, 2026-09-30). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@mateo-berri @ryan-crabbe-berri @kerry-berri @yuneng-berri friendly ping for a review, since you're the requested code owners for the cost maps. I merged |
TopxAI retired claude-sonnet-5 on 2026-10-02 (requests answer 403) and offers claude-sonnet-5-5 at the same shared-pool prices (https://ai.topxea.com/pricing/claude-sonnet-5-5).
# Conflicts: # ui/litellm-dashboard/src/components/provider_info_helpers.tsx
Conflicts were neighbouring additions (reka, openinfer, inferenceapis, typesafe, nace) next to the TopxAI entries; both sides kept. The TopxAI endpoint-support rows gain the new "interactions": false key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TopxAI corrected the shared-pool lane on 2026-10-23; GET https://ai.topxea.com/api/pricing now lists claude-shared cache_read 0.05, half of Anthropic's $0.10, like the other lanes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # litellm/constants.py # litellm/llms/openai_like/providers.json # litellm/types/utils.py
TopxAI moved its GLM, Kimi and DeepSeek models onto private deployments with fixed prices on 2026-11-08 (route_prices[auto_route] at https://ai.topxea.com/api/pricing). Both price maps change identically: - kimi-k3.1-pro: $0.50 input, $0.30 cache read, $5 output per million tokens, and no cache-write price - GLM-5.3-Abliterated: $2 / $0.30 / $4 - deepseek-flash-Abliterated: $0.28 / $0.07 / $1, 131,072 output tokens - new GLM-5.3-Flash-Abliterated: $0.24 / $0.08 / $1, text and images, 1,048,576 context, 131,072 output - new deepseek-flash-fast: $0.02 / $0.004 / $0.16, 1,048,576 context, 262,144 output; no response-schema or forced tool-choice claim The tests drop Kimi from the cache-write routes, cover both new models in the metadata, Responses and backup-sync cases, and check fixed prices at all hours for both DeepSeek models.
TopxAI repriced its three abliterated private deployments on 2026-11-10 (USD per 1M input / output / cache read): GLM-5.3-Abliterated 3 / 6 / 0.45, GLM-5.3-Flash-Abliterated 0.36 / 1.50 / 0.075, deepseek-flash-Abliterated 0.42 / 1.50 / 0.105. The same day Claude Fable 5.2 replaced Fable 5.1 with no forwarding alias, so topxai/claude-fable-5-1 becomes topxai/claude-fable-5-2 at the shared-pool price (4 / 20 / 0.10, cache writes 5 and 8 for 5 minutes and 1 hour), with the same limits and flags. Both cost maps change identically and stay byte-identical; every topxai entry matches https://ai.topxea.com/api/pricing as read on 2026-11-10.
….xyz TopxAI's API site moved on 2026-11-13. The previous host answers 308, and HTTP clients drop the Authorization header on that cross-host redirect, so the old default base URL fails with 401.
# Conflicts: # litellm/llms/openai_like/providers.json
|
@kerry-berri could you review the TopxAI cost entries and approve the fork CI run for ea09b1f? GitHub lists 14 workflows awaiting approval. The live proxy returned HTTP 200 on all 12 combinations of Astra/Sol, Chat/Responses/Messages, and streaming/non-streaming. The merge base returned 400 on those same calls. The request examples and observed costs are in the PR description. The 855 relevant tests passed locally, the CLA check passed, and Veria cleared the credential fallback finding. The companion provider guide uses the native provider introduced here. Its docs workflow and Vercel preview also need BerriAI approval. Landing the guide with or just after the implementation would keep the examples usable. Thanks for taking a look. |
TopxAI merged its shared and official routes on 2026-11-18: Claude, GPT and Grok are each sold on one route at 80% of the lab's list price in every lane, long-context tiers included. Update the twelve cost-map entries (root and backup) from route_prices[auto_route] in https://api.topxai.xyz/api/pricing and pin the Auto-route prices per million tokens in the provider test. The GLM, Kimi and DeepSeek private deployments keep their fixed prices.
…ek-flash-Abliterated reprice TopxAI replaced kimi-k3.1-pro with kimi-k3.1-pro-Abliterated on 2026-11-19 ($3.25 input / $0.325 cache read / $6.50 output per 1M tokens; json_schema works on it) and repriced deepseek-flash-Abliterated to $0.36 / $0.075 / $1.35. Source: https://api.topxai.xyz/api/pricing (2026-11-19).
Update, November 19, 2026: TopxAI now offers
kimi-k3.1-pro-Abliterated(Kimi K3.1 Pro with the refusal alignment removed, $3.25 input / $0.325 cache read / $6.50 output per 1M tokens), which replaceskimi-k3.1-pro; the old ID returns 403.deepseek-flash-Abliteratedmoved to $0.36 / $0.075 / $1.35. This PR is updated to match https://api.topxai.xyz/api/pricing.TopxAI users currently need a custom OpenAI-compatible base URL and separate prices. This adds a named provider with TopxAI credentials, Chat Completions and Responses routing, and cost tracking for twelve current text models
Screenshots / Proof of Fix
Dashboard screenshots
On Models + Endpoints → Add Model, I searched for
TopxAIon the merge base02b4292eand onea09b1fe. Both dashboards ran in the same Chrome tab against the same empty admin fixture, with the provider catalogue supplied by the respective checkout.Before and after the provider was registered
Before — the provider search returned “No providers found.”
After — the provider picker shows the TopxAI name and logo.
Selecting it exposes the GPT-6.2 model IDs and the default API base. The API key field is empty in this fixture.
Live proxy proof
On 2026-11-17 UTC I ran the proxy on the merge base
02b4292e200c6d2c8789340451fa66a0766aaf08and onea09b1fe8181a98a37f9227b588cc0c194b8aa4d. Both used CPython 3.13.12, Uvicorn 0.51.0, two workers, a dedicated loopback Redis 7.2.8, and the cost map shipped with their respective checkout. The merge base loggedLLM Provider NOT providedfor bothtopxai/models, and returned HTTP 400 for all twelve requests before dispatch. The PR routes returned HTTP 200 and the textOKon each of the twelve combinations. The candidate sent the requests to TopxAI using a temporary shared-route key.Proxy config, curl requests and observed costs
For each command below, set
modelto eithergpt-6.2-astraorgpt-6.2-sol. These examples show the original request bodies. Port 58336 served the merge base.All calls used
Reply with exactly OK.The table lists input and output tokens, the USD cost fromx-litellm-response-coston regular responses or finalusage.coston streams, and the proxy call ID. The response model field echoed the requested ID in every case.35be6183-8937-4792-80a1-d2494a652af3ac60388c-8bc0-44ff-b220-2baec8cedcf3766eef99-4631-4b08-853d-424302e1e5bc3ab41870-956c-49c3-aa47-7715aab3ee162c9a727b-24b5-4f8c-93b1-fd47d20e8c837c932551-19c6-4de8-8365-2f95e637ec8f1e6a06f9-96a4-46dc-b90c-802a2b617cca64ff0287-3baf-41dd-8060-a331395005c0b34b87fb-09c9-4573-b97f-61eb37df2ba7e245bac8-2576-4d66-b090-8fee2e2ca1c62b9ac3cb-8f0a-46e6-9378-43d2d27afab89682594c-4460-4caf-98b5-26051ee0df90The last Chat Completions chunk carried the OpenAI-shaped usage, the Responses stream carried usage in
response.completed.response.usage, and the Messages stream carried cost inmessage_delta.usage. For example, the Astra Chat stream ended with{"prompt_tokens":11,"completion_tokens":5,"total_tokens":16,"cost":0.000144}(usage excerpt). That matches 11 input tokens at $4 per million plus 5 output tokens at $20 per million, the Auto-route price on November 17. Sol matched $1 input and $5 output per million. Since November 18 these models cost $6.40 / $32 (Astra) and $1.60 / $8 (Sol), so the Astra Chat call above now costs $0.0002304 and each Sol call $0.0000784; the cost map in this PR carries those prices.Across the twelve combinations and two extra captures of non-streaming Responses, TopxAI recorded 14 settled requests and a total wallet debit of $0.001514 after per-request quota rounding. The two extra captures replaced incomplete local transcripts of successful HTTP 200 calls. Both paid test keys were disabled and returned HTTP 401 after the run.
Details
TLDR
Problem this solves:
How it solves it:
User Flow
Before, developers configure a custom endpoint and maintain prices separately
After, developers can select the named provider and its published Auto-route prices
TOPXAI_API_KEYtopxai/claude-sonnet-5-5withcompletion, or a supported model withresponsesCurrent catalogue
Verified against the public pricing API and model guides on November 18, 2026. Pricing API The entries follow each model's
auto_route, rather than original-provider reference prices or every route sold by TopxAIOn the evening of November 18, 2026, TopxAI merged its shared-pool and official-line routes: Claude, GPT and Grok are each sold on one route at 80% of the lab's list price in every lane, long-context tiers included. GLM, Kimi and DeepSeek keep their fixed private-deployment prices. Per million tokens (input / output / cache read / cache write):
claude-sonnet-5-5claude-opus-5-5claude-fable-5-2gpt-6.2-astragpt-6.2-solgpt-6.1-terragrok-4.7On November 8 TopxAI moved its GLM, Kimi and DeepSeek models onto private deployments with fixed prices. None of the five publishes a cache-write price or a long-context tier, so their entries carry input, cache-read and output prices only, and a cache write bills as input
kimi-k3.1-pro-Abliterated(since November 19, replacingkimi-k3.1-pro) is priced at $3.25 input, $6.50 output and $0.325 cache read per million tokens, with no cache-write price. Its published context and output limits are 1,048,576 and 131,072. Chat supports vision, function calling and selecting a named function. The host ignorestool_choice: none,tool_choice: requiredand strict JSON schemas, so the two general LiteLLM capability flags are off. Kimi guidedeepseek-flash-Abliteratedreplaces the retired Flash ID at fixed $0.36 input, $1.35 output and $0.075 cache read per million tokens (the prices TopxAI set on November 19). It has 1,048,576 context and 131,072 output tokens, and does not inherit the original DeepSeek model's peak schedule. Strict response schemas are covered by published acceptance, while forced tool selection is not claimed. Retireddeepseek-v4-prois removeddeepseek-flash-fastis DeepSeek V4.1 Flash on standard weights at $0.02 input, $0.16 output and $0.004 cache read, with 1,048,576 context and 262,144 output tokens. It ignoresjson_schemaand the none and required tool choices. Selecting a named function works. DeepSeek guideGLM-5.3-Abliteratedis $3 input, $6 output and $0.45 cache read, text only.GLM-5.3-Flash-Abliteratedis $0.36 input, $1.50 output and $0.075 cache read, with text and image input, 1,048,576 context and 131,072 output tokensgpt-6.1-terrais included at $0.80 input, $4 output, $0.04 cache read and $1 cache write per million tokens on the Auto route. From 272,001 input tokens, the full request uses $1.60 input, $6 output, $0.08 cache read and $2 cache write. The context window is 1,050,000 tokens, including up to 922,000 input tokens, with up to 128,000 output. Terra advertises vision, reasoning, prompt caching, structured output and tool choice. November 18 checks verified a forced custom tool and strict JSON schemas on Chat Completions and Responses. All three GPT rows advertise text and image input and leave PDF input disabled. Terra guide · Astra and Sol guideclaude-fable-5-2replacesclaude-fable-5-1, which TopxAI retired on November 10 with no forwarding alias (the old ID returns HTTP 403). It is $6.40 input, $32 output, $0.16 cache read, and $8 / $12.80 for 5-minute / 1-hour cache writes on the Claude route, with 1,000,000 context and 128,000 output tokensGPT context premiums start at 272,001 input tokens and Grok's at 200,000. Claude one-hour cache writes remain included. Native Responses routing covers all three GPT models, Grok, Kimi, both DeepSeek models and GLM Flash. Claude and text-only GLM use LiteLLM’s Chat Completions conversion. Claude supports automatic tool use but rejects forced tools, so its model rows leave the unrestricted tool-choice flag off. Endpoint reference
Relevant issues
Companion documentation is BerriAI/litellm-docs#1558
Validation
Updated on November 13, 2026 at
93ce084c86: merges upstream4dad0bc513(457 commits). The only conflict was the TopxAI logo, which now sits in the dashboard's new location,litellm/ui/litellm-dashboard/public/assets/logos/topxai.svg. Againstmainthe PR still only adds lines: 12 files, 960 insertions. Both cost maps stay byte-identical with no duplicate keys, and all twelvetopxai/entries match the live Auto-route prices and limits in/api/pricingtoday, including cache lanes and context tiers. Both endpoint maps are identicalWith Python 3.12.2 and the native bridge built from this checkout, the same five test files plus
test_aaamodel_prices_and_context_window_json_is_validpass: 320 tests.litellm/scripts/generate_provider_endpoints_support.py --checkandgit diff --checkpass. No paid requests were madeUpdated on November 13, 2026 at
fa65b5b, directly after4c2f30efb1: TopxAI's API site moved toapi.topxai.xyz. The previous host answers 308, and HTTP clients drop theAuthorizationheader on that cross-host redirect, so the old default base URL fails with 401. This commit changes the host in the default base URL (litellm/constants.py,providers.json), the dashboard placeholder, the 24sourcelinks in the two cost maps and the test's expected URLs: 37 lines in six files, each the same host substitution with the paths unchanged. Prices, limits and model IDs are untouched. The TopxAI entries in both cost maps stay identical,scripts/generate_provider_endpoints_support.py --checkandgit diff --checkpass, and Ruff 0.15.3 reports nothing new on the changed Python files. The pytest run was not repeated for this host-only change. No paid requests were madeUpdated on November 10, 2026 at
4c2f30efb1, directly afterf3de0ae7e4: 35 lines in three files, no upstream merge. TopxAI repriced its three abliterated private deployments that day and retiredclaude-fable-5-1in favour ofclaude-fable-5-2. Both cost maps change identically, stay byte-identical and have no duplicate keys. Everytopxai/entry's token, cache-read and cache-write prices and its limits were compared with the live Auto-route catalogue: twelve entries, no differenceThe same five test files pass, 323 tests, with Python 3.12.16 and the native bridge built from this checkout. Restoring only the two cost maps to
f3de0ae7e4makes the metadata test fail withtopxai/claude-fable-5-2 missing, and restoring this change passes.scripts/generate_provider_endpoints_support.py --check, Ruff checks and formatting on the changed test, andgit diff --checkpass. No paid requests were madeUpdated on November 9, 2026 at
f3de0ae7e4, directly after5092788df5. This follow-up adds 43 lines in three files and does not merge unrelated upstream changes. The two price maps remain byte-identical with no duplicate keys. All eight Terra token and cache rates and both limits were checked against the live Auto-route catalogue323 tests pass in the five affected files with Python 3.13.12 and the native bridge built from this checkout. The command was
.venv/bin/python -m pytest tests/unit/llms/openai_like/test_topxai_provider.py tests/unit/test_cost_map_guard.py tests/unit/test_model_prices_and_context_window.py tests/unit/litellm_core_utils/test_get_model_cost_map.py tests/code_coverage_tests/test_generate_provider_endpoints_support.py -q. Coverage includes Terra Responses routing, normal and cached prices around the 272,001-token threshold, and backup-map parity. Restoring both cost maps to5092788df5makes the expanded metadata test fail withtopxai/gpt-6.1-terra missing, then restoring this change passes.venv/bin/python scripts/generate_provider_endpoints_support.py --check, Ruff checks and formatting on the changed test, andgit diff --checkpass. No paid requests or live proxy end-to-end run were made. External CI and reviews are still required for the updated tipEarlier, on November 8, 2026 at
5092788df5, on top of3b67f9607c, which merges upstream48ff826cbc. Against that merge base the PR only adds lines: 12 files, 917 insertions, no deletions. Both price maps are byte-identical, as are both endpoint maps, and neither has a duplicate key.generate_provider_endpoints_support.py --checkpasses309 tests pass locally in the five affected files: the TopxAI provider tests, the cost-map guard, the full model-price/context-window file, the cost-map loader and the endpoint-support generator.
ruff check,ruff format --checkandgit diff --checkpass. The workflow runs on3b67f9607cwere waiting for maintainer approval, so CI has not yet run on the merged tipEarlier, on October 28 at
1241046c57: Upstream94e4ebd63dis merged, preserving the other provider registrations added upstream alongside TopxAI. TopxAI entries in both catalogue files usemax_output_tokenswithout the retiredmax_tokensalias. 161 focused tests pass: the TopxAI provider and the adjacent JSON-configured provider, JSON loader, dynamic configuration and the full model-price/context-window test file. The OSV scan on that tip reported dependencies inuv.lockandvscode-extension/package-lock.json; this PR does not change either filePre-Submission checklist
ea09b1feand the CLA check passedCaveats
Medium
anthropic/pathNovember 18 catalogue update
The two cost maps now use
topxai/gpt-6.2-astraandtopxai/gpt-6.2-sol. Short-context Auto-route input / output per million tokens are $6.40 / $32 for Astra and $1.60 / $8 for Sol (80% of list since the route merge below). The whole-request tier starts at 272,001 input tokens. Each model accepts up to 922,000 input tokens and 128,000 output tokens. TopxAI migration guideChat and text completions now require provider credentials before dispatch. To run the regression checks in a configured LiteLLM development environment, use
LITELLM_LOCAL_MODEL_COST_MAP=True pytest -q tests/unit/llms/openai_like tests/unit/test_cost_map_guard.py tests/unit/rust_bridge/host/test_model_cost.py. These 855 tests passed atea09b1fe. The live price table, 12 runtime model records and eight native Responses routes were independently checked. The new tests cover missing, configured and explicitly supplied credentials. Review fixNovember 18 route merge
On the evening of November 18, 2026, TopxAI merged its shared-pool and official-line routes: Claude, GPT and Grok are each sold on one route at 80% of the lab's list price in every lane, long-context tiers included. GLM, Kimi and DeepSeek keep their fixed private-deployment prices.
6616a729updates the twelvetopxai/entries in both cost maps fromroute_prices[auto_route]in the public pricing API: 96 values change, all on the seven Claude, GPT and Grok models (base, cache and long-context lanes, and Grok's twotiered_pricingbands); the five private deployments are unchanged. A new parametrized test pins each model's Auto-route input, output, cache-read and cache-write price per million tokens, so the existing boundary tests also fix the long-context rates. The mergeaf797dd1brings in upstreamda8c02b9(77 commits) without conflicts. Routes and pricesWith Python 3.12.13 and the locked environment,
pytest tests/unit/llms/openai_like tests/unit/test_model_prices_and_context_window.py tests/unit/test_utils.py::test_aaamodel_prices_and_context_window_json_is_validpasses 909 tests; the two failures aretest_aiand_provider.pytimezone cases that calltime.tzset, which Windows lacks, in a file this PR does not touch. The TopxAI file alone passes 101 tests, 13 of them new; with the cost map restored to the merge commit, 7 of the 13 fail, one per repriced model.litellm/scripts/ci_cd/cost_map_guard.pypasses against the merge base, and Ruff 0.15.3 check and format pass on the changed test. Both cost maps stay identical for everytopxai/entry. No paid requests were made for this price-only change.