feat: add Opper as a model provider preset - #1340
Merged
Merged
Conversation
Opper is an EU-hosted AI gateway run by Opper Technology AB (Stockholm): one API key and one OpenAI-compatible endpoint reach models from 30+ upstream providers at each provider's own token rates, with no markup, and requests can be pinned to EU-hosted regions. It is wired exactly like the Vercel AI Gateway preset: an OpenAI chat completions endpoint with an empty model list, so the catalog is imported on demand from GET /models. - src/shared/model-provider-preset-catalog-extended.ts: the preset - src/shared/model-provider-preset-types.ts: the preset id - packages/provider-catalog/src/index.ts: the shared catalog entry - src/main/models-dev-catalog.ts: Opper is published on models.dev as `opper`, so the preset maps straight onto that catalog - docs/model-provider-presets.md: the Built-in Providers entry No icon asset, matching Vercel AI Gateway, so the diff stays additive. Model ids come in two forms and the docs entry explains both: a bare pool name such as claude-sonnet-4-6 routes across every provider serving that model, and provider/model such as aws/claude-sonnet-4-6-eu pins one provider or region. I work at Opper. Happy to adjust anything to match project conventions. Not verified locally: `npm test` needs the full dependency install, which I did not run here. Every change is a data entry mirroring the adjacent gateway preset, plus one union member and one catalog mapping.
packages/provider-catalog/src/index.test.ts freezes the catalog size, the expanded entry count and the per-category counts. Adding an api preset moves three of them: 26 -> 27 presets, 32 -> 33 entries, and 12 -> 13 in the api category. Subscription and free counts are unchanged.
Custom or duplicated provider profiles pointing at https://api.opper.ai/v3/compat carry a profile id other than 'opper', so PROFILE_MATCHES misses them and catalog import silently returns nothing. Mirror the Vercel AI Gateway wiring by adding the endpoint to UNAMBIGUOUS_URL_MATCHES. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
7 tasks
6 tasks
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.
Supersedes #1337 — carries the author's two commits unchanged and adds one fix commit on top, since "Allow edits from maintainers" is off on the fork branch.
Summary / 概要
GET /models.<provider>/<model>ids (e.g.aws/claude-sonnet-4-6-eu) pin a provider or region.Why / 背景
opperexists on models.dev withapi: https://api.opper.ai/v3/compat, matching the preset base URL;docs.opper.aiandplatform.opper.airesolve.UNAMBIGUOUS_URL_MATCHESwas missing'https://api.opper.ai/v3/compat': 'opper', so custom or duplicated profiles (e.g.my-opper-gateway) pointing at the Opper endpoint could not resolve the models.dev catalog and silently got no model metadata. Vercel AI Gateway covers both the profile-id and URL paths; this restores parity.Changes / 变更
src/shared/model-provider-preset-types.ts: addoppertoModelProviderPresetIdsrc/shared/model-provider-preset-catalog-extended.ts: the presetpackages/provider-catalog/src/index.ts: shared catalog entry (categoryapi,chat_completions)src/main/models-dev-catalog.ts:opperprofile match + Opper endpoint inUNAMBIGUOUS_URL_MATCHESsrc/main/models-dev-catalog.test.ts: deterministic + custom-id URL match cases for Opperpackages/provider-catalog/src/index.test.ts: catalog count updates (26→27, 32→33, api 12→13)docs/model-provider-presets.md: Built-in Providers entryMedia / 截图或录屏
Tests / 测试
npx vitest run src/main/models-dev-catalog.test.ts— 54 passednpx vitest run src/shared/app-settings-provider.presets.test.ts src/renderer/src/components/provider-icon.test.ts— 49 passedpackages/provider-catalog:vitest run— 4 passedValidation / 验证
npm run test(affected files / 相关测试文件)npm run typechecknpm run buildnpm run dev(no runtime or UI behavior change / 无运行时或界面行为变化)Notes / 备注
Generated with Devin