feat: add multi-provider support with deployment-level LLM provider override#1
Draft
joshuadavidthomas wants to merge 2 commits into
Draft
feat: add multi-provider support with deployment-level LLM provider override#1joshuadavidthomas wants to merge 2 commits into
joshuadavidthomas wants to merge 2 commits into
Conversation
…verride Add infrastructure to route LLM calls through alternative providers (e.g., Cloudflare AI Gateway) without changing the model registry. A deployment-level `LLM_PROVIDER_OVERRIDE` env var replaces the provider prefix before passing model config to OpenCode. For example, setting `LLM_PROVIDER_OVERRIDE=cloudflare` routes `anthropic/claude-sonnet-4-6` as `cloudflare/claude-sonnet-4-6` — OpenCode handles the rest natively. Changes: - shared: add PROVIDER_METADATA, ProviderId type, detectUpstreamProvider() - modal-infra: remove hard ANTHROPIC_API_KEY requirement from llm_secrets - modal-infra: 3-line provider override in sandbox entrypoint - modal-infra: refactor bridge reasoning to detect upstream provider for gateway providers (cloudflare proxying to anthropic/openai) - terraform: add llm_provider_override, cloudflare_ai_gateway_* variables and conditionally inject into Modal secrets - tests: 14 new tests covering provider override, upstream detection, and gateway reasoning options (all 899 existing tests still pass) https://claude.ai/code/session_01SfZd4jtoYjZUBXJyMNRNQ9
…Gateway Verified against OpenCode docs (https://opencode.ai/docs/providers/): - Provider ID is "cloudflare-ai-gateway" (not "cloudflare") - Env vars are CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_GATEWAY_ID (not CLOUDFLARE_AI_GATEWAY_*) - OpenCode config needs a "provider" section to register the gateway provider with its available models Also adds a test for non-gateway provider overrides. https://claude.ai/code/session_01SfZd4jtoYjZUBXJyMNRNQ9
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.
No description provided.