feat(models): add SCX.ai general-purpose provider - #3333
Conversation
Add scx-ai-gp, a second SCX.ai provider covering the general-purpose (non-Turbo) tier, with GLM-5.2 as its first model. The existing scx-ai id is left untouched so no persisted value changes meaning and no data migration is required. It is renamed for display only, to "SCX.ai (Turbo)", and now declares soc2: 1 and iso27001: true — previously omitted, which meant orgs with requireSoc2 or requireIso27001 enabled silently skipped SCX under the fail-closed compliance policy. scx-ai-gp shares the api.scx.ai base URL, the LLM_SCX_AI_API_KEY credential, the OpenAI-compatible request and streaming paths and the SCX wordmark with the Turbo tier. It carries no modelCardBadge, so the badge-presence sort keeps Turbo first on shared model pages. The Turbo tier's tool_calls finish-reason normalization is deliberately not extended to it. GLM-5.2 is priced at $1.00/M input, $0.20/M cached input and $3.143/M output. maxOutput is 131072, taken from the endpoint's own validator rather than the published catalogue, which advertises a 128k ceiling.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
WalkthroughThe PR adds ChangesSCX.ai GP integration
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant Gateway
participant SCXAPI
Client->>Gateway: Send SCX.ai GP chat request
Gateway->>SCXAPI: POST /v1/chat/completions
SCXAPI-->>Gateway: Return response or stream
Gateway-->>Client: Return OpenAI-compatible output
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/gateway/src/chat/tools/transform-streaming-to-openai.ts`:
- Line 1432: Remove scx-ai-gp from the Turbo finish-reason normalization case
group and add a separate scx-ai-gp branch that invokes transformOpenaiStreaming
without applying the end_turn, abort, or tool_use mappings. Add regression
coverage verifying all three finish reasons remain unchanged for the GP
provider.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 045fda5b-b187-4ce5-bff6-cf2e246687bd
📒 Files selected for processing (7)
apps/gateway/src/chat/tools/transform-response-to-openai.tsapps/gateway/src/chat/tools/transform-streaming-to-openai.tsapps/ui/src/components/provider-keys/provider-logo.tspackages/actions/src/get-provider-endpoint.tspackages/models/src/models/zai.tspackages/models/src/providers.tspackages/shared/src/components/provider-icons.tsx
| case "inference.net": | ||
| case "together-ai": | ||
| case "scx-ai": | ||
| case "scx-ai-gp": |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep scx-ai-gp out of the Turbo finish-reason normalization branch.
Adding scx-ai-gp to this case group applies the mappings at Line [1469]-Line [1482]: end_turn becomes stop, abort becomes upstream_error, and tool_use becomes tool_calls. The PR objective states that this normalization must not apply to the GP provider.
Add a separate scx-ai-gp case that calls transformOpenaiStreaming without these mappings. Add regression tests for the three finish reasons.
Separate the GP provider case
+ case "scx-ai-gp": {
+ transformedData = transformOpenaiStreaming(
+ data,
+ usedModel,
+ supportsReasoning,
+ );
+ break;
+ }
+
case "mistral":
...
case "scx-ai":
- case "scx-ai-gp":📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| case "scx-ai-gp": | |
| case "scx-ai-gp": { | |
| transformedData = transformOpenaiStreaming( | |
| data, | |
| usedModel, | |
| supportsReasoning, | |
| ); | |
| break; | |
| } | |
| case "mistral": | |
| ... | |
| case "scx-ai": |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/gateway/src/chat/tools/transform-streaming-to-openai.ts` at line 1432,
Remove scx-ai-gp from the Turbo finish-reason normalization case group and add a
separate scx-ai-gp branch that invokes transformOpenaiStreaming without applying
the end_turn, abort, or tool_use mappings. Add regression coverage verifying all
three finish reasons remain unchanged for the GP provider.
Adds
scx-ai-gp, a second SCX.ai provider for the general-purpose(non-Turbo) tier, with GLM-5.2 as its first model.
SCX serves two distinct tiers from
api.scx.ai. The existingscx-aiprovider represents the Turbo tier and carries the "Up to 4x faster"
model-card badge. That claim does not hold for the general-purpose tier,
so rather than widening
scx-aiand diluting its badge, this adds aseparate provider id.
The existing
scx-aiid is left untouched, so no persisted value changesmeaning and no data migration is required.
Changes to
scx-aidistinguishable in the UI. The id, badge, models and prices are
unchanged.
soc2: 1andiso27001: true. These were previously omitted,which — since the compliance policy is fail-closed — meant orgs with
requireSoc2orrequireIso27001enabled silently skipped SCX.New provider
scx-ai-gpShares the
api.scx.aibase URL, theLLM_SCX_AI_API_KEYcredential,the OpenAI-compatible request and streaming paths and the SCX wordmark
with the Turbo tier. It carries no
modelCardBadge, so the existingbadge-presence sort keeps Turbo first on shared model pages.
The Turbo tier's
tool_callsfinish-reason normalization is deliberatelynot extended to
scx-ai-gp— the general-purpose tier returns theOpenAI-standard
finish_reasonalready, soparse-provider-response.tsis unchanged.
Data policy: AU headquarters, no API training, no consumer training, no
prompt logging, 0-day retention, SOC 2 Type 1, ISO 27001.
GLM-5.2 mapping
maxOutputis set from the endpoint's own validator rather than thepublished catalogue: SCX rejects
max_tokensabove 131072 with"expected a value <= 131072", while its model card advertises a 128k
ceiling.
Verification
pnpm formatandpnpm buildpass locally; unit tests left to CI./e2eforTEST_MODELS="scx-ai-gp/glm-5.2"if a maintainer would like it.Summary by CodeRabbit