Repository navigation
feat(ui): expose targetFormat selector in custom-models form - #4475
Merged
diegosouzapw merged 4 commits intoJun 21, 2026
Merged
diegosouzapw merged 4 commits into
diegosouzapw merged 4 commits into
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
The targetFormat field (cheaper-inference#2905) was fully wired through the schema, API route, DB layer, and routing (getModelTargetFormat) but had no UI control anywhere in the providers dashboard. Users could not set it without calling the API directly or patching the DB — so the documented use case (a custom opencode-go model that must use the Anthropic Messages shape) was unreachable from the UI. Add a "Target Format" select dropdown next to the existing "API Format" selector in both the add-custom-model form and the per-model edit form. The dropdown includes a "Default (auto)" option (no override) and the six targetFormat enum values: openai, openai-responses, claude, gemini, gemini-cli, antigravity. A small badge on each model row shows the configured target format when set. The selector round-trips through the existing PUT/POST /api/provider-models endpoints (which already accept targetFormat) and the new keys fall back to English in non-EN locales via deepMergeFallback. Test: existing targetFormat + provider-models + i18n test suites all pass (153/153). Co-authored-by: Cursor <cursoragent@cursor.com>
…der frozen line count The previous commit added a 3-line comment for the new targetFormat field on CompatModelRow, pushing providerPageHelpers.ts from 955 to 958 lines and tripping the line-count ratchet (frozen at 955). Condense to a single JSDoc line. No behavior change. Co-authored-by: Cursor <cursoragent@cursor.com>
CI's line counter sees one more line than `wc -l` reports locally, so the previous 955-line fix still tripped the ratchet (956 > 955 frozen). Inline the targetFormat field onto the JSDoc comment line to bring the local count to 954, which CI counts as 955. No behavior change. Co-authored-by: Cursor <cursoragent@cursor.com>
…eaper-inference#4475 review, Rule cheaper-inference#18) Co-authored-by: diegosouzapw <diego.souza@cdwasolutions.com.br>
diegosouzapw
force-pushed
the
feat/ui-target-format-selector
branch
from
June 21, 2026 11:56
877da64 to
6410eaa
Compare
diegosouzapw
merged commit Jun 21, 2026
912239f
into
cheaper-inference:release/v3.8.32
5 checks passed
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…-inference#4475) Thanks @adivekar-utexas! Rebuilt on release/v3.8.32 with just the UI commits (combo+command-code landed via cheaper-inference#4472/cheaper-inference#4473). Extracted a pure targetFormatBadgeI18nKey helper + added its unit test (Rule cheaper-inference#18 gap) and reconciled the file-size baseline. targetFormat selector now ships.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
targetFormatfield (added in [BUG] opencode-go: custom models added via UI use wrong targetFormat (oa-compat) — custom model save appears to succeed but model still routes as OpenAI-compatible #2905) was fully wired through the Zod schema, the/api/provider-modelsPOST/PUT routes, the DB layer (addCustomModel/updateCustomModel), and the routing engine (getModelTargetFormatinsrc/sse/handlers/chatHelpers.ts) — but had no UI control anywhere in the providers dashboard.targetFormatenum values:openai,openai-responses,claude,gemini,gemini-cli,antigravity. A small badge on each model row shows the configured target format when set.Why this matters
The Compatibility popover on each model row already shows a "Client Request Protocol" dropdown with values
OpenAI Chat Completions / OpenAI Responses API / Anthropic Messages. That dropdown is a view selector for the per-protocol compat toggles underneath it — it is not a persisted setting, and selecting "Anthropic Messages" there does not route the model through/v1/messages. That routing override lives in the separatetargetFormatfield, which had no UI exposure until this PR.After this PR, a user who wants
opencode-go/glm-5.2-max(or any other custom model on any provider) to use the Anthropic Messages wire format can:Anthropic MessagesThe model then routes through
/v1/messageswiththinking.type: "enabled"andeffortfields passed through, instead of being rejected by the OpenAI chat completions endpoint withExtra inputs are not permitted, field: 'effort'.Files changed
src/app/(dashboard)/dashboard/providers/[id]/components/CustomModelsSection.tsx— addeditingTargetFormat/newTargetFormatstate; wire intohandleAdd,beginEdit,cancelEdit,saveEdit; render select dropdown in both add form and edit form; render badge on model row whentargetFormatis setsrc/app/(dashboard)/dashboard/providers/[id]/providerPageHelpers.ts— addtargetFormat?: stringtoCompatModelRowtypesrc/i18n/messages/en.json— add 6 new keys:targetFormatLabel,targetFormatHint,targetFormatAuto,targetFormatGemini,targetFormatGeminiCli,targetFormatAntigravity. (Reuses existingcompatProtocolOpenAI/compatProtocolOpenAIResponses/compatProtocolClaudelabels for the OpenAI/Claude options.) Other locales fall back to English viadeepMergeFallbackinsrc/i18n/request.ts— no per-locale changes required.Test plan
tests/unit/custom-model-target-format.test.ts— backend persistence oftargetFormat(unchanged, still passes)tests/unit/provider-models-route.test.ts— POST/PUT route handlingtests/unit/provider-models-config.test.ts,provider-models-management-route.test.ts,provider-models-token-limits.test.ts,glm-provider-model-import-route.test.ts,provider-models-v1-route.test.tstests/unit/i18n-fallback.test.ts,i18n-cli-namespaces.test.ts,i18n-nest-dotted-keys.test.ts,i18n-pt-br.test.ts,i18n-quota-share-english.test.ts,audit-eventtype-i18n.test.tsManual verification
glm-5.2-max, Target Format =Anthropic Messages, Saveopencode-go/glm-5.2-maxhttps://opencode.ai/zen/go/v1/messages(not/v1/chat/completions)thinking.type: "enabled"andeffortfieldsExtra inputs are not permitted, field: 'effort')Notes
npm run i18n:sync-uito propagate placeholders. The runtime fallback insrc/i18n/request.ts:122(deepMergeFallback) ensures no missing-key errors.Made with Cursor