Skip to content

Send bare Jev model ids in OpenRouter's own form; release 0.7.4 - #15

Merged
DevMortimer merged 2 commits into
mainfrom
fix/openrouter-model-ids
Sep 24, 2026
Merged

DevMortimer merged 2 commits into
mainfrom
fix/openrouter-model-ids

Conversation

@DevMortimer

Copy link
Copy Markdown
Owner

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-latest and a pinned version typesafe/jev-<major>.<minor>, so the bare TypeSafe id did not resolve.

Change

  • backendModelId(backend, model) in src/backends.ts maps a bare Jev id for OpenRouter: jev-latest becomes ~typesafe/jev-latest, and jev-1.13 or jev-1.13.0 becomes typesafe/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.
  • The client applies the mapping to its default model and to a per-request model in evaluate(). The 1–100 character check still applies to the caller's own id, before mapping.
  • /typesafe status derives its Model: line from the same rule instead of a hardcoded jev-latest. The extension uses the TypeSafe backend, so the visible text is unchanged.
  • docs/api.md documents the mapping. Not exported from src/index.ts, so the public API is unchanged.
  • Release 0.7.4: package.json, package-lock.json, and CHANGELOG.md.

Verification

  • npm ci and npm run check pass: build, typecheck, 104 offline tests.
  • Offline tests capture the request body through the injected 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-request model on OpenRouter. One test checks the status line.
  • Documentation and changelog updated.

Live check: OpenRouter's public model endpoint resolves both ~typesafe/jev-latest and typesafe/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

  • No public export added or removed. TypeSafe backend behavior is unchanged.
  • Limitation: the mapping is keyed on the backend name, so a custom backend config passes model ids unchanged.

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.
@DevMortimer
DevMortimer merged commit 2dd46f8 into main Sep 24, 2026
8 checks passed
@DevMortimer
DevMortimer deleted the fix/openrouter-model-ids branch September 24, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant