Repository navigation
feat(scaledown): add native text provider support - #44168
Conversation
|
|
|
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 5 · PR risk: 0/10 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance
|
72c8a3a to
b657d96
Compare
Registers the five ScaleDown models in the pricing map. ScaleDown bills on input tokens only, so output_cost_per_token is zero for every entry. The classify and decisions models bill at $0.04 per million input tokens, and extract, summarize, and compress bill at $0.05 per million. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
b657d96 to
7fb04fd
Compare
Removes the localStorage-backed ScaleDown mock now that the engine knows the provider (arthur-common#228). Every ScaleDown request goes to the real API: credentials, model whitelist, catalog, and model pickers, which offer ScaleDown once it's configured. The table still lists ScaleDown first. No backend code changes: ScaleDown is an API-key provider, which the engine already handles generically, and its catalog comes from litellm's cost map. Completions start working when litellm ships the provider (BerriAI/litellm#44168, #44167) and the pins are bumped. Regenerates staging.openapi.json and adds the API changelog entry for the new enum value. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ontext limits Every ScaleDown model now bills $0.04 per million input tokens. The 32000-token max_input_tokens/max_output_tokens values were not confirmed against the service, so they are removed rather than registered. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
7fb04fd to
1d60afa
Compare
This is the standard rate in ScaleDown's billing and matches the usage dashboard. The Decisions usage.cost field is not used for pricing. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1d60afa to
9f1a4da
Compare
|
@greptileai review |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
6d4795e to
2904581
Compare
|
@greptileai Please review this updated commit, which resolves the merge conflict while preserving all existing provider pricing |
|
@greptileai Please review the escaped-reference fix. Eight regression cases failed before this change and pass now, alongside the existing provider tests |
|
@greptileai Please review the final reference fix. Escaped names now preserve nested fields, and unresolved references return HTTP 400 before contacting ScaleDown |
|
@greptileai Please review the final commit. The full local check passes, with escaped-reference regression coverage and fresh live API verification |
TLDR
Problem this solves:
How it solves it:
x-api-keyauthenticationUser Flow
Before, a developer cannot send ScaleDown requests through the proxy
http://127.0.0.1:4021/v1/chat/completionsAfter, the same task returns the native result and tracked cost
http://127.0.0.1:4019/v1/chat/completionsx-litellm-response-costIn the Admin UI, open
/ui/models-and-endpoints/, choose Add Model, and search for scaledown under Provider. Before, the search returns no providers. After, ScaleDown is selectable and exposes its API key fieldImplementation and validation
scaledown/classifycalls/classifywith labels.scaledown/decisionscalls/v1/scaledownwith questions and the upstream modelclassify-1. Extraction combines scalar matches with nested results and removes provider span wrappers while retaining the untouched payload in SDK hidden parametersThe adapter uses the existing HTTP handler for sync, async, and simulated streaming. ScaleDown has its own dispatch entry. The existing xAI helper, xAI dispatch branch, and shared HTTP transport are unchanged. The provider registry input and ScaleDown model set are typed. Schema expansion bounds recursion, reference chains, and entity count
The focused provider and pricing suite passes 136 tests with 98% adapter coverage locally. The expanded run passes 501 tests, including 365 existing xAI, provider-routing, endpoint-matching, cost-map, and timeout tests. A baseline comparison confirms all 4,035 existing pricing entries, 2,558 existing models, and existing provider registries, endpoint declarations, and Admin UI credential fields are unchanged. Only ScaleDown entries are added.
make checkpasses, including full type checking, test quality, formatting, and API schema sync. The adapter also passes strict type checking with zero errors. The recursion detector and CI shard inventory pass. The production docs build passes, and the page was inspected in a browserLive checks also passed for mixed extraction, strict-schema rejection, image rejection, and streaming with
extra_body.labelsandstream_options.include_usage. Mixed extraction and nullable nested extraction both returned{"vendor":"Northwind","invoice":{"amount":500}}. Developer-message summarization returned the expected summary. An invalid question type and a nullable schema with sibling properties returned HTTP 400 and zero cost. A live request with a deliberately invalid key also invoked the SDK post-call logger with the provider's HTTP 402 response. Rejected requests returned HTTP 400 and zero cost. Streaming returned the classification result, 521 input tokens, and cost0.00002605The review follow-up preserves nullable nested objects and arrays, rejects ambiguous schema composition, treats malformed question types and unknown model names as HTTP 400, and forwards developer instructions for summarization. Malformed HTTP 200 responses become HTTP 502 errors
The provider model set is
Finalbut stays mutable because pricing reloads update references held by existing callers. The bounded schema walker has explicit mutation exceptions to carry its entity budget and visited references. Adapter validation errors use one shared_rejectfunction. The ScaleDown dispatch preserves the existing post-call hook when an upstream request failsFour earlier regression cases failed before the fixes and pass afterward. Three reject sibling schema definitions beside nullable unions or
$refinstead of dropping fields. The fourth checks that a failed upstream request reaches the caller'slogger_fnas a post-call eventThe latest review fix decodes URI fragments and JSON Pointer escapes before following local schema references. Unresolvable or unsupported references return HTTP 400 instead of silently dropping fields. All eight new regression cases failed on
3cdcd956a58b2436f692ba4f26580c5f664bd307and pass on this tip. A fresh live request using the definition nameInvoice/~1 Detailsreturns both the vendor and amount. A missing definition returns HTTP 400 and zero costMerge dependencies
The docs PR is merged into main. The documentation and code-quality checks now pass against the merged docs, including the checks for
SCALEDOWN_API_KEYandSCALEDOWN_API_BASEThe pricing PR contains the same ScaleDown registry and price entries. Both code PRs use $0.05 per million input tokens with output free, so either merge order preserves the rate
Both code PRs now include main at
16fcbffa7fd344c611c627ef720961b4cdd1c211. The pricing-file conflict retains both new Azure embedding models and all five ScaleDown entries. Both branches merge cleanly, including with each other. The updated cost-map guard passes locallyAll four required checks pass on
0c942ec2794ba00fbe306e8b19c0ca82b5721e31, including lint, unit, smoke, and cost-map-guard. Greptile reviewed this commit at 5/5. Veria reports no open security concerns. No Bugbot result is available, so it is not recorded as a passPre-Submission checklist
Screenshots / Proof of Fix
Captured against a localhost proxy and the real ScaleDown API. The baseline is the merge base below. The fresh API run uses the provider code at the current tip. The Admin UI screenshots show the unchanged ScaleDown selector from the earlier validation. No mocked upstream responses were used
Use a real ScaleDown key in
SCALEDOWN_API_KEY, set a local proxy master key, and use that master key asLITELLM_API_KEYin the curl commands. Start the baseline proxy on port 4021 and the updated proxy on port 4019 with this configSave these request bodies in the named files
classify.json{"model":"scaledown-classify","messages":[{"role":"user","content":"My server has been down for three hours."}],"labels":[{"name":"urgent","rubric":"Service is unavailable."},{"name":"routine","rubric":"A question or cosmetic issue."}]}extract.json{"model":"scaledown-extract","messages":[{"role":"user","content":"Invoice from Northwind. Total: $500."}],"response_format":{"type":"json_schema","json_schema":{"name":"invoice","strict":false,"schema":{"type":"object","properties":{"vendor":{"type":"string","description":"company name"}}}}}}summarize.json{"model":"scaledown-summarize","messages":[{"role":"system","content":"Summarize in one sentence."},{"role":"user","content":"The team shipped the billing fix on Monday. Error rates fell. A follow-up review is scheduled for Friday."}],"max_tokens":64}decisions.json{"model":"scaledown-decisions","messages":[{"role":"user","content":"I was charged twice for my subscription this month."}],"questions":{"category":{"type":"choice","criteria":{"billing":"A charge or refund.","technical":"A bug."}}}}compress.json{"model":"scaledown-compress","messages":[{"role":"system","content":"The team shipped a billing fix. Error rates fell after the release."},{"role":"user","content":"What changed after the release?"}],"compression_rate":"auto"}extract-escaped-ref.json{"model":"scaledown-extract","messages":[{"role":"user","content":"Invoice from Northwind for $500."}],"response_format":{"type":"json_schema","json_schema":{"name":"invoice","strict":false,"schema":{"type":"object","$defs":{"Invoice/~1 Details":{"type":"object","properties":{"vendor":{"type":"string"},"amount":{"type":"number"}}}},"properties":{"invoice":{"$ref":"#/$defs/Invoice~1~01%20Details"}}}}}}extract-missing-ref.json{"model":"scaledown-extract","messages":[{"role":"user","content":"Invoice from Northwind for $500."}],"response_format":{"type":"json_schema","json_schema":{"name":"invoice","strict":false,"schema":{"type":"object","$defs":{"Invoice/~1 Details":{"type":"object","properties":{"vendor":{"type":"string"},"amount":{"type":"number"}}}},"properties":{"invoice":{"$ref":"#/$defs/Missing"}}}}}}Before (16fcbff)
Classify
Extract
Summarize
Decisions
Compress
Extraction with escaped references
Unresolved extraction reference
Admin UI provider selection
http://127.0.0.1:4021/ui/models-and-endpoints/, choose Add Model, and search for scaledownAfter (0c942ec)
Classify
Extract
Summarize
Decisions
Compress
Extraction with escaped references
Unresolved extraction reference
Admin UI provider selection
http://127.0.0.1:4019/ui/models-and-endpoints/, choose Add Model, and search for scaledownType
New Feature
Caveats
Medium
Low