Skip to content

feat(provider): add Requesty preset and OpenCode provider mapping - #60

Merged
0xranx merged 4 commits into
0xranx:mainfrom
Thibaultjaigu:add-requesty-provider
Sep 25, 2026
Merged

0xranx merged 4 commits into
0xranx:mainfrom
Thibaultjaigu:add-requesty-provider

Conversation

@Thibaultjaigu

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds Requesty (OpenAI-compatible LLM gateway) as a provider, wired everywhere OpenRouter is:

  • src/provider-presets.ts: new requesty preset (https://router.requesty.ai/v1, REQUESTY_API_KEY, default anthropic/claude-sonnet-4-5). The EU endpoint router.eu.requesty.ai/v1 is noted in the description.
  • src/engines/opencode.ts and src/engines/provider-env.ts: requesty prefix maps to REQUESTY_API_KEY, so ensureOpenCodeConfig writes the provider block for requesty/... models.
  • OpenCodeEngine.listModels: for requesty/... models, lists chat models from the public GET /v1/models/managed endpoint, falling back to GET /v1/models, then to the opencode CLI like the OpenRouter branch.
  • src/onboard.ts and src/doctor.ts: REQUESTY_API_KEY counts as a configured key. OpenRouter stays the default everywhere.
  • Docs (en and zh): OpenCode model/prefix tables, env var table, OpenCode reference table, and a short Requesty example under the OpenCode + OpenRouter case in provider routing.

How to test:

engine: opencode
provider:
  baseUrl: "https://router.requesty.ai/v1"
  apiKey: "${REQUESTY_API_KEY}"
  model: "requesty/openai/gpt-4o-mini"

Get a key at https://app.requesty.ai/api-keys, then REQUESTY_API_KEY=... golembot run.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (describe below)

Checklist

  • pnpm run build passes
  • pnpm run test passes (1334 passed, 6 skipped)
  • New code has tests (if applicable): preset, env mapping, opencode.json provider block, listModels managed endpoint and fallback
  • Updated documentation (if applicable)

biome check src/ reports no issues in the touched files. I also ran it end to end: OpenCodeEngine.invoke with requesty/openai/gpt-4o-mini through opencode 1.18.18 returned the expected reply, and listModels returned 159 managed models.

Disclosure: I work at Requesty. Happy to adjust anything to match project conventions.

Adds a requesty provider preset, maps the requesty/ model prefix to REQUESTY_API_KEY for OpenCode, lists models from the Requesty managed endpoint (falling back to the full catalog), and detects REQUESTY_API_KEY in onboard and doctor.
@0xranx

0xranx commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution! The build and 1,334 tests pass (6 skipped), but I found two things to fix before merging:

  1. Model IDs need the requesty/ prefix. Both catalog paths return raw IDs, and /model passes them through unchanged. Copying a managed ID like claude-sonnet-4-5 from /model list fails; a fallback ID like openai/gpt-4o-mini selects the OpenAI provider instead of Requesty. Please return requesty/${id} from both paths and update the tests.

  2. The documented EU endpoint is not passed to the Requesty provider. provider.baseUrl only becomes OPENAI_BASE_URL; the generated opencode.json has no provider.requesty.options.baseURL. In OpenCode 1.18.18, provider URL resolution uses that option or the catalog URL, so this configuration still uses the global endpoint. Please wire the URL through and test it, or remove the EU example until supported. This matters for users expecting EU routing.

I checked the live catalog endpoints and reproduced these gaps with three additional local test cases. I have not run an authenticated Requesty model call.

@Thibaultjaigu

Copy link
Copy Markdown
Contributor Author

Thanks for the careful review, both points were right.

  1. Model IDs: fixed in 879d998. Both the managed listing and the fallback catalog now return requesty/${id}, so anything copied from /model list goes straight back to Requesty. The two listModels tests in engine.test.ts now assert the prefixed IDs for each path.

  2. Base URL: fixed in a1e50a2. When provider.baseUrl is set and the model is requesty/..., it is written to provider.requesty.options.baseURL in the generated opencode.json, so the EU router is actually used. New ensureOpenCodeConfig tests cover the EU URL being written and other providers staying untouched. I also checked it by hand against OpenCode 1.18.18: the EU URL answers, and a bogus baseURL in the same config fails to connect, so OpenCode is reading that option.

@0xranx
0xranx merged commit 4524607 into 0xranx:main Sep 25, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.51.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants