Add Requesty provider#811
Open
Thibaultjaigu wants to merge 1 commit into
Open
Conversation
Add an optional direct Requesty provider route to the SDK, mirroring the existing direct ChatGPT OAuth route in sdk/src/impl/model-provider.ts. When REQUESTY_API_KEY is set, chat completions are routed directly to the Requesty OpenAI-compatible router (https://router.requesty.ai/v1) using the existing @codebuff/llm-providers OpenAICompatibleChatLanguageModel shim, instead of going through the Codebuff backend. Model ids use the same provider/model form (e.g. openai/gpt-4o-mini). When the env var is unset, behavior is unchanged. - common/src/constants/requesty.ts: base URL + env var name (mirrors byok.ts) - sdk/src/env.ts: getRequestyApiKeyFromEnv helper - sdk/src/impl/model-provider.ts: createRequestyModel + wiring in getModelForRequest - sdk/src/impl/__tests__/model-provider-requesty.test.ts: route selection tests - docs/agents-and-tools.md, sdk/README.md: provider docs
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.
Summary
Adds an optional direct Requesty provider route to the SDK. Requesty is an OpenAI-compatible model router (
https://router.requesty.ai/v1) that uses the sameprovider/modelid form as OpenRouter (e.g.openai/gpt-4o-mini,anthropic/claude-sonnet-4.5).When the
REQUESTY_API_KEYenvironment variable is set, chat completions are routed directly to the Requesty router using the existing@codebuff/llm-providersOpenAICompatibleChatLanguageModelshim, instead of going through the Codebuff backend. When the env var is unset, behavior is unchanged.This mirrors the existing direct ChatGPT OAuth route in
sdk/src/impl/model-provider.ts(createOpenAIOAuthModel), which already builds anOpenAICompatibleChatLanguageModelpointed at a fixed upstream base URL with a Bearer key rather than the Codebuff backend. No new provider registry was invented — the change reuses the existing model-routing entry point (getModelForRequest).Changes
Code:
common/src/constants/requesty.ts(new):REQUESTY_BASE_URLandREQUESTY_ENV_VARconstants, mirroringcommon/src/constants/byok.ts.sdk/src/env.ts:getRequestyApiKeyFromEnv()helper, mirroringgetByokOpenrouterApiKeyFromEnv().sdk/src/impl/model-provider.ts:createRequestyModel()(mirrorscreateOpenAIOAuthModel()) and a direct-route branch at the top ofgetModelForRequest().Tests:
sdk/src/impl/__tests__/model-provider-requesty.test.ts(new): asserts the route is selected whenREQUESTY_API_KEYis set (provider === 'requesty') and that the default Codebuff backend route is used when it is unset.Docs:
sdk/README.md: new "Model providers" section documenting the Requesty route.docs/agents-and-tools.md: matching "Model providers" section.Verification
Typecheck (no repo-wide script; ran the affected projects):
sdk:tsc --noEmit -p tsconfig.json→ exit 0packages/llm-providers:bun run typecheck→ exit 0Tests (
bun test):model-provider-requesty.test.ts(2) andmodel-provider-free-mode.test.ts(4) → 6 pass / 0 fail.Live test against the Requesty router:
GET https://router.requesty.ai/v1/models→ HTTP 200POST https://router.requesty.ai/v1/chat/completionswithopenai/gpt-4o-mini→ real completion returned (modelgpt-4o-mini-2024-07-18).Notes
I work at Requesty. This mirrors the existing OpenRouter provider as closely as possible. Happy to adjust or close it if it is not a fit.