Send bare Jev model ids in OpenRouter's own form; release 0.7.4 - #15
Merged
Merged
Conversation
A caller who writes the TypeSafe default model: "jev-latest" on the OpenRouter backend got a 400, because OpenRouter routes that id as its alias ~typesafe/jev-latest and a bare version as typesafe/jev-<major>. <minor>. backendModelId() maps a bare Jev id for the backend that needs it, for the client default and a per-request model alike; ids that already carry an author, and every model on TypeSafe direct, pass unchanged. The validation limits still apply to the caller's own id. /typesafe status now derives its Model line from the same rule instead of naming jev-latest unconditionally.
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.
What and why
On the OpenRouter backend, a caller who wrote the TypeSafe default
model: "jev-latest"got HTTP 400. OpenRouter names that model~typesafe/jev-latestand a pinned versiontypesafe/jev-<major>.<minor>, so the bare TypeSafe id did not resolve.Change
backendModelId(backend, model)insrc/backends.tsmaps a bare Jev id for OpenRouter:jev-latestbecomes~typesafe/jev-latest, andjev-1.13orjev-1.13.0becomestypesafe/jev-1.13. Ids that already carry an author (vendor/model), unknown bare ids, and every model on the TypeSafe backend pass unchanged. Mapping is idempotent.modelinevaluate(). The 1–100 character check still applies to the caller's own id, before mapping./typesafe statusderives itsModel:line from the same rule instead of a hardcodedjev-latest. The extension uses the TypeSafe backend, so the visible text is unchanged.docs/api.mddocuments the mapping. Not exported fromsrc/index.ts, so the public API is unchanged.package.json,package-lock.json, andCHANGELOG.md.Verification
npm ciandnpm run checkpass: build, typecheck, 104 offline tests.fetch: the default model,jev-latest,jev-1.13,jev-1.13.0, an id with an author, the TypeSafe backend unchanged, and a per-requestmodelon OpenRouter. One test checks the status line.Live check: OpenRouter's public model endpoint resolves both
~typesafe/jev-latestandtypesafe/jev-1.13, and returns 404 for a version that does not exist. No key was used, and no judgment request was sent.Compatibility and release notes