docs: document OpenAI-compatible gateway support (including OrcaRouter) - #431
Conversation
There was a problem hiding this comment.
Pull request overview
Adds OrcaRouter as a first-class, OpenAI-compatible language model provider across the TypeScript and Python TypeChat SDKs, including environment-variable routing, tests, and documentation updates.
Changes:
- Add OrcaRouter language model factories (
createOrcaRouterLanguageModel/create_orca_router_language_model) and route viacreateLanguageModel/create_language_modelwhenORCAROUTER_API_KEYis set. - Add TypeScript and Python tests covering OrcaRouter factory behavior and env-var routing (including endpoint override).
- Update docs and
.env.exampleto document OrcaRouter configuration alongside OpenAI and Azure OpenAI.
Show a summary per file
| File | Description |
|---|---|
| typescript/tests/model.test.mjs | Adds routing + factory tests for OrcaRouter in the TS test suite. |
| typescript/src/model.ts | Implements OrcaRouter factory and extends env-var routing to include OrcaRouter. |
| site/src/docs/typescript/basic-usage.md | Documents OrcaRouter usage in TypeScript basics page. |
| site/src/docs/python/basic-usage.md | Documents OrcaRouter usage in Python basics page. |
| site/src/docs/examples.md | Updates examples documentation to include OrcaRouter environment variables. |
| python/tests/test_model.py | Adds tests for the OrcaRouter factory behavior in Python. |
| python/src/typechat/_internal/model.py | Implements OrcaRouter factory and extends env-var routing in Python. |
| python/src/typechat/init.py | Exports the new OrcaRouter factory from the public Python package API. |
| .env.example | Adds OrcaRouter env-var templates (including optional endpoint override). |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 9/9 changed files
- Comments generated: 5
- Review effort level: Lite
| export function createOpenAILanguageModel(apiKey: string, model: string, endPoint? string): TypeChatLanguageModel; | ||
|
|
||
| export function createAzureOpenAILanguageModel(apiKey: string, endPoint: string): TypeChatLanguageModel; | ||
|
|
||
| export function createOrcaRouterLanguageModel(apiKey: string, model: string, endPoint? string): TypeChatLanguageModel; |
There was a problem hiding this comment.
Fixed — the signature now reads endPoint?: string in the trimmed docs-only PR.
| For even more convenience, TypeChat also provides a function to infer which | ||
| provider you're using. | ||
|
|
||
| ```ts |
There was a problem hiding this comment.
Fixed — the fence for create_language_model is now py instead of ts.
| | Variable | Value | | ||
| |----------|-------| | ||
| | `ORCAROUTER_MODEL` | The OrcaRouter model name (e.g. `orcarouter/auto` or `orcarouter/free`) | | ||
| | `ORCAROUTER_API_KEY` | Your OrcaRouter API key | |
There was a problem hiding this comment.
Superseded — per maintainer feedback the OrcaRouter-specific ORCAROUTER_ENDPOINT variable was removed; the docs now use the existing OPENAI_ENDPOINT variable for OpenAI-compatible gateways.
| # SPDX-License-Identifier: MIT | ||
|
|
||
| from typechat._internal.model import PromptSection, TypeChatLanguageModel, create_language_model, create_openai_language_model, create_azure_openai_language_model | ||
| from typechat._internal.model import PromptSection, TypeChatLanguageModel, create_language_model, create_openai_language_model, create_azure_openai_language_model, create_orca_router_language_model |
There was a problem hiding this comment.
No longer applicable — the OrcaRouter export was removed from python/src/typechat/__init__.py; the file is back to baseline.
| @@ -187,8 +190,13 @@ def required_var(name: str) -> str: | |||
| api_key=required_var("AZURE_OPENAI_API_KEY") | |||
| endpoint=required_var("AZURE_OPENAI_ENDPOINT") | |||
| return create_azure_openai_language_model(api_key, endpoint) | |||
| elif "ORCAROUTER_API_KEY" in vals: | |||
There was a problem hiding this comment.
No longer applicable — the OrcaRouter routing branch was removed from python/src/typechat/_internal/model.py; the file is back to baseline.
|
Thanks for the contribution and for the clear disclosure. TypeChat already supports OrcaRouter today via the endPoint parameter on createOpenAILanguageModel / create_openai_language_model — your own quickstart's base-URL swap maps directly onto it. Adding named factories per OpenAI-compatible gateway isn't a direction we want to take, since it commits us to maintaining third-party endpoints in shipped packages and sets a precedent we'd have to extend to a dozen other providers. We'd welcome a trimmed PR that adds a vendor-neutral 'using an OpenAI-compatible gateway' docs section instead, with OrcaRouter as one of the named examples." |
robgruen
left a comment
There was a problem hiding this comment.
See my *vendor neutral" doc comment on the PR summary.
Adds a vendor-neutral "Using OpenAI-compatible gateways" section to the TypeScript and Python basic-usage pages and the examples env-var guide. OpenAI-compatible services (e.g. OrcaRouter, OpenRouter) can be used via the existing endPoint parameter / OPENAI_ENDPOINT variable, so no new provider-specific factories or env-var routing are needed. Co-Authored-By: Claude <noreply@anthropic.com>
a7859b8 to
cdb35be
Compare
|
Thanks for the feedback and the clear direction. I've trimmed the PR to match:
The full diff is now docs-only across three files. The site builds cleanly with |
Motivation
TypeChat already supports OpenAI-compatible endpoints via the existing OpenAI factory and environment-variable configuration. This means services such as OrcaRouter and OpenRouter can be used without needing a custom provider implementation.
The docs did not clearly call out that pattern, so this PR adds examples showing how to configure TypeChat against those gateways.
Changes
Notes
This is a documentation update only. TypeChat’s supported mechanism for OpenAI-compatible gateways is the existing OpenAI client path, including OPENAI_ENDPOINT and custom endpoint arguments.
Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter
I'm an engineer on the OrcaRouter team.