Skip to content

feat(agent): support OpenAI-compatible gateways via vendor/model names - #100

Open
kannan983 wants to merge 1 commit into
CopilotKit:mainfrom
kannan983:feat/97-openai-compatible-gateway-models
Open

kannan983 wants to merge 1 commit into
CopilotKit:mainfrom
kannan983:feat/97-openai-compatible-gateway-models

Conversation

@kannan983

@kannan983 kannan983 commented Oct 10, 2026 •

Copy link
Copy Markdown

Closes #97

Summary

Lets the agent use OpenAI-compatible gateways such as OpenRouter, so self-hosters can choose other or cheaper models.

  • build_model treats LLM_MODEL values containing / (e.g. deepseek/deepseek-chat) as OpenAI-compatible and builds ChatOpenAI. The OpenAI SDK picks up OPENAI_BASE_URL, so no new settings are needed.
  • The error message for unsupported names now mentions the vendor/model form.
  • .env.example, docs/getting-started.md and docs/deployment.md document OPENAI_BASE_URL.

claude-*, gpt-* and chat-latest behave as before. BYOK browser keys still go to https://api.openai.com/v1 only.

Testing

  • New test_vendor_model_names_route_to_openai_compatible_gateway: checks the ChatOpenAI type, the model name, and that the client base URL comes from OPENAI_BASE_URL.
  • uv run --directory apps/agent pytest: 112 passed
  • Tried through OpenRouter with deepseek/deepseek-v4.1-flash and anthropic/claude-sonnet-5.5: text answers and interactive widgets work. Widgets also need fix(agent): stop duplicate streaming with server-held keys #99, which fixes duplicate streaming that affects every server-key setup.

This branch has not been deployed

No deployments
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.

Support OpenAI-compatible gateways (OpenRouter) via vendor/model names

1 participant