Skip to content

feat: add Opper as a model provider preset - #1337

Closed
Felixkw12 wants to merge 2 commits into
KunAgent:developfrom
opper-ai:add-opper-provider
Closed

Felixkw12 wants to merge 2 commits into
KunAgent:developfrom
opper-ai:add-opper-provider

Conversation

@Felixkw12

Copy link
Copy Markdown

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.

Summary / 概要

Why / 背景

Changes / 变更

Media / 截图或录屏

  • UI changes: attach a video or GIF here.
  • 界面变更:请在这里附上视频或 GIF。

Tests / 测试

  • Logic changes: list unit tests added or updated.
  • 逻辑变更:请列出新增或更新的单元测试。

Validation / 验证

  • I agree that this contribution is submitted under the Contributor License Agreement. / 我同意本贡献遵循 Contributor License Agreement 提交。
  • npm run test
  • npm run typecheck
  • npm run build
  • npm run dev (if runtime or UI behavior changed / 如果运行时或界面行为有变化)
  • UI change: video or GIF attached / 界面变更:已附上视频或 GIF
  • Logic change: unit tests added or updated / 逻辑变更:已新增或更新单元测试

Notes / 备注

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.
@XingYu-Zhong

Copy link
Copy Markdown
Collaborator

Thanks for the contribution — the preset is wired correctly and opper on models.dev checks out (api: https://api.opper.ai/v3/compat, matching the preset base URL).

One gap before this can merge: UNAMBIGUOUS_URL_MATCHES in src/main/models-dev-catalog.ts is missing 'https://api.opper.ai/v3/compat': 'opper'. Profiles whose provider id is not exactly opper — e.g. a duplicated opper-2 account or a custom provider pointing at the Opper endpoint — would fail to resolve the models.dev catalog and silently get no model metadata. The Vercel AI Gateway preset covers both the profile-id path and the URL path; Opper should match it.

Since "Allow edits from maintainers" is off on the fork branch, I've carried your commits into #1340 and added the fix + test cases there. This PR is superseded by #1340 — happy to credit you in the merge.

@XingYu-Zhong

Copy link
Copy Markdown
Collaborator

This PR has been superseded by #1340, which has been merged into develop.

#1340 carries your two original commits (authorship preserved) plus one fix on top:

  • fix(providers): resolve Opper base URL to the models.dev catalog — adds https://api.opper.ai/v3/compat to UNAMBIGUOUS_URL_MATCHES, so custom/copied profiles pointing at the Opper URL also resolve the models.dev catalog, plus test coverage.

It also picked up baseline fixes from develop (#1341) that were blocking CI. Thanks for the contribution!

@Felixkw12

Copy link
Copy Markdown
Author

Thanks for catching the UNAMBIGUOUS_URL_MATCHES gap, that was a real hole. A profile id of opper-2 or a custom profile pointing at the same endpoint would have resolved nothing and silently lost model metadata.

Closing in favour of #1340. Appreciate you carrying the commits over and adding the test cases.

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.

2 participants