feat(providers): add SCX.ai as a JSON-configured OpenAI-compatible provider - #34752
feat(providers): add SCX.ai as a JSON-configured OpenAI-compatible provider#34752bhuvan2134686 wants to merge 5 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryAdds SCX.ai as a JSON-configured OpenAI-compatible provider
Confidence Score: 4/5The PR appears safe to merge, with only a misleading Add Model placeholder remaining Selecting SCX.ai now works, but the model field falls back to the generic gpt-3.5-turbo placeholder instead of showing the SCX model identifier declared in provider metadata Files Needing Attention: ui/litellm-dashboard/src/components/provider_info_helpers.tsx
|
| Filename | Overview |
|---|---|
| litellm/llms/openai_like/providers.json | Registers SCX.ai chat completions with its base URL, environment variables, token mapping, and temperature ceiling |
| litellm/proxy/public_endpoints/provider_create_fields.json | Adds the SCX.ai provider and credential metadata required by the Add Model dropdown |
| ui/litellm-dashboard/src/components/provider_info_helpers.tsx | Adds SCX.ai display and logo mappings |
| model_prices_and_context_window.json | Adds pricing, context limits, and capabilities for five SCX.ai chat models |
| tests/test_litellm/llms/openai_like/test_scx_ai_provider.py | Covers provider registration, parameter transformation, model metadata synchronization, and dashboard selection metadata |
Reviews (2): Last reviewed commit: "fix(ui): make SCX.ai selectable in the A..." | Re-trigger Greptile
| @@ -260,6 +262,7 @@ export const provider_map: Record<string, string> = { | |||
| SageMaker: "sagemaker_chat", | |||
There was a problem hiding this comment.
SCX missing from provider options
When an operator opens the Add Model provider dropdown, the form renders only entries returned by /public/providers/fields, whose static provider_create_fields.json data has no SCX.ai entry, so these new display mappings remain unreachable and SCX.ai cannot be selected
Knowledge Base Used: Admin dashboard (ui/litellm-dashboard)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Good catch on the Add Model dropdown, the display mapping on its own was not enough. The provider is now in Verified against the live proxy $ curl -sS http://localhost:4000/public/providers/fields | jq -c '.[] | select(.litellm_provider=="scx-ai")'
{"provider":"SCX_AI","provider_display_name":"SCX.ai","litellm_provider":"scx-ai","credential_fields":[{"key":"api_base","label":"API Base","placeholder":"https://api.scx.ai/v1","tooltip":null,"required":false,"field_type":"text","options":null,"default_value":null},{"key":"api_key","label":"API Key","placeholder":null,"tooltip":null,"required":true,"field_type":"password","options":null,"default_value":null}],"default_model_placeholder":"scx-ai/gpt-oss-120b"}The same push adds the five chat models to the cost map with published rates and capability flags, which restores cost tracking and lets $ curl -sS http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
-d '{"model":"scx-gemma-4","messages":[{"role":"user","content":"What is the weather in Sydney? Use the tool."}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"max_tokens":128}' \
| jq -c '.choices[0].message.tool_calls[0].function'
{"arguments":"{\"city\":\"Sydney\"}","name":"get_weather"}The PR description is updated with the full run |
TLDR
Problem this solves:
openai/with a customapi_baseand lose provider naming, cost tracking, the endpoint support matrix and the Add Model entry in the dashboardtemperatureat 1.0 and takesmax_tokensrather thanmax_completion_tokens, so requests that pass either straight through get rejected upstreamHow it solves it:
scx-aithrough the JSON provider registry inlitellm/llms/openai_like/providers.json, expressing the temperature ceiling as a constraint and mappingmax_completion_tokenstomax_tokens, so no Python transformation module is neededRelevant issues
N/A, this adds a new OpenAI-compatible provider
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito 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 proxy on
localhost:4000against the real SCX.ai API, no mocks, started withEvery model answers and cost tracking resolves from the new price map entries
The gemma-4 figure checks out by hand against the committed rates, 35 prompt tokens at $0.30 per million plus 4 completion tokens at $0.91 per million is $1.414e-05
Tool calling round trips
$ curl -sS http://localhost:4000/v1/chat/completions \ -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \ -d '{"model":"scx-gemma-4","messages":[{"role":"user","content":"What is the weather in Sydney? Use the tool."}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"max_tokens":128}' \ | jq -c '.choices[0].message.tool_calls[0].function' {"arguments":"{\"city\":\"Sydney\"}","name":"get_weather"}A temperature above the provider ceiling is clamped by the constraint rather than sent upstream and rejected
$ curl -sS http://localhost:4000/v1/chat/completions \ -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \ -d '{"model":"scx-gemma-4","messages":[{"role":"user","content":"say ok"}],"temperature":1.7,"max_tokens":16}' \ | jq -c '{content: .choices[0].message.content, error: .error.message}' {"content":"ok","error":null}Streaming
$ curl -sS -N http://localhost:4000/v1/chat/completions \ -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \ -d '{"model":"scx-gemma-4","messages":[{"role":"user","content":"Count 1 to 3."}],"stream":true,"max_tokens":64}' | head -3 data: {"id":"76dfe914-c080-4c13-bbf3-d84ada45aef8","created":1785136143,"model":"scx-gemma-4","object":"chat.completion.chunk","system_fingerprint":"fastcoe","choices":[{"index":0,"delta":{"content":"1","role":"assistant"}}]} data: {"id":"76dfe914-c080-4c13-bbf3-d84ada45aef8","created":1785136143,"model":"scx-gemma-4","object":"chat.completion.chunk","system_fingerprint":"fastcoe","choices":[{"index":0,"delta":{"content":", 2, 3"}}]}Health check
The metadata the Add Model form renders now includes the provider, which is what makes it selectable in the dropdown
With that proxy running and
npm run devinui/litellm-dashboard, go to http://localhost:3000/ui/?page=llm-playground, open Models and Endpoints, then Add Model, and pick SCX.ai from the Provider dropdown; it renders with the SCX logo, asks for an API key and offers the api base overrideType
New Feature
Changes
The provider is registered as JSON config rather than a Python module, since the SCX.ai API is OpenAI compatible and needs no custom authentication, transformation or streaming logic. The entry in
providers.jsoncarries the base URL, theSCX_API_KEYenvironment variable, theSCX_API_BASEoverride, themax_completion_tokenstomax_tokensmapping and atemperature_maxconstraint of 1.0Beyond that,
scx-aigoes intoLlmProviders, intoopenai_compatible_providersandopenai_compatible_endpoints, into thehttps://api.scx.ai/v1autodetection branch inget_llm_provider_logic.pyso an api base alone resolves the provider, and into the endpoint support matrix along with the packaged backup copy the proxy serves from/public/endpoints. Five chat models land in the cost map with published USD rates, context limits and capability flags, MiniMax-M2.7 also carrying the published cached input rate; those flags are what lettoolsandreasoning_effortthrough, since LiteLLM derives support for both from the cost mapOn the dashboard side the provider needs two things, the display metadata and logo in
provider_info_helpers.tsx, and an entry inprovider_create_fields.json, which is the static metadata the Add Model form renders from/public/providers/fields. Without the second one the display mapping is unreachable and the provider cannot be picked, so both are includedTests live in
tests/test_litellm/llms/openai_like/test_scx_ai_provider.pyand cover provider registration, the JSON config values, model prefix resolution, api base override and endpoint autodetection, the temperature clamp in both the clamped and unclamped direction, the parameter mapping, router configuration, that every listed model is present in both the root and backup cost maps with matching metadata, and that the create-fields entry the dropdown depends on exists with the right key, display name and credential fields. The dashboard test inprovider_info_helpers.test.tsxasserts SCX.ai resolves from both the slug and the enum key, since the Add Model dropdown passes the enum key while the backend passes the slugI work at SCX.ai
QA runbook
Export
SCX_API_KEY, start the proxy with the config above, then run the curl commands in the proof section. All five deployments should answer with non zero cost headers, the tool call should come back as aget_weathercall, the temperature 1.7 request should succeed rather than error,/healthshould report the deployment healthy, and/public/providers/fieldsshould include the scx-ai entryFinal Attestation