Skip to content

docs: document OpenAI-compatible gateway support (including OrcaRouter) - #431

Open
kuswardhanietidims-svg wants to merge 1 commit into
microsoft:mainfrom
kuswardhanietidims-svg:feat/orcarouter-provider
Open

docs: document OpenAI-compatible gateway support (including OrcaRouter)#431
kuswardhanietidims-svg wants to merge 1 commit into
microsoft:mainfrom
kuswardhanietidims-svg:feat/orcarouter-provider

Conversation

@kuswardhanietidims-svg

@kuswardhanietidims-svg kuswardhanietidims-svg commented Aug 28, 2026

Copy link
Copy Markdown

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

  • Documented how to use an OpenAI-compatible gateway in the TypeScript basic-usage guide
  • Documented the same pattern in the Python basic-usage guide
  • Added an examples section showing how to set OPENAI_ENDPOINT for gateway-based usage
  • Clarified that OrcaRouter can be used through the standard OpenAI-compatible endpoint flow

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 via createLanguageModel / create_language_model when ORCAROUTER_API_KEY is set.
  • Add TypeScript and Python tests covering OrcaRouter factory behavior and env-var routing (including endpoint override).
  • Update docs and .env.example to 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

Comment thread site/src/docs/typescript/basic-usage.md Outdated
Comment on lines +71 to +75
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;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the signature now reads endPoint?: string in the trimmed docs-only PR.

Comment thread site/src/docs/python/basic-usage.md Outdated
For even more convenience, TypeChat also provides a function to infer which
provider you're using.

```ts

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the fence for create_language_model is now py instead of ts.

Comment thread site/src/docs/examples.md Outdated
Comment on lines +85 to +88
| Variable | Value |
|----------|-------|
| `ORCAROUTER_MODEL` | The OrcaRouter model name (e.g. `orcarouter/auto` or `orcarouter/free`) |
| `ORCAROUTER_API_KEY` | Your OrcaRouter API key |

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread python/src/typechat/__init__.py Outdated
# 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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer applicable — the OrcaRouter export was removed from python/src/typechat/__init__.py; the file is back to baseline.

Comment thread python/src/typechat/_internal/model.py Outdated
Comment on lines +189 to +193
@@ -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:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer applicable — the OrcaRouter routing branch was removed from python/src/typechat/_internal/model.py; the file is back to baseline.

@robgruen

Copy link
Copy Markdown
Contributor

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 robgruen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@kuswardhanietidims-svg

Copy link
Copy Markdown
Author

Thanks for the feedback and the clear direction. I've trimmed the PR to match:

  • Removed the OrcaRouter-specific factories (createOrcaRouterLanguageModel / create_orca_router_language_model), the ORCAROUTER_* env-var routing in createLanguageModel / create_language_model, and the associated tests and exports.
  • Added a vendor-neutral "Using OpenAI-compatible gateways" section to the TypeScript and Python basic-usage docs and the examples env-var guide. It shows the existing endPoint parameter and OPENAI_ENDPOINT variable, with OrcaRouter as one named example (alongside OpenRouter), and I also fixed the endPoint? string signature typo in the TypeScript snippet.

The full diff is now docs-only across three files. The site builds cleanly with npm run build (eleventy).

@robgruen robgruen changed the title feat: add OrcaRouter as a first-class language model provider doc: add OrcaRouter as an example API router/provider Sep 3, 2026
@robgruen robgruen changed the title doc: add OrcaRouter as an example API router/provider docs: document OpenAI-compatible gateway support (including OrcaRouter) Sep 3, 2026
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.

3 participants