Python: Add OrcaRouter provider samples - #7900
Closed
nissrin2020ali-ux wants to merge 1 commit into
Closed
Conversation
Add a new orcarouter/ folder under the providers samples that shows how to use the OrcaRouter gateway through the existing OpenAI-compatible clients. OrcaRouter is an OpenAI-compatible AI gateway for models and agents that, like OpenRouter, exposes a provider/model namespace across many models while also combining adaptive routing, failover, observability, guardrails, and agent-tool governance behind the same endpoint. Samples cover both the Chat Completions client and the Responses client, including streaming and tool calling, and the providers overview README now links the new folder. Co-Authored-By: Claude <noreply@anthropic.com>
nissrin2020ali-ux
temporarily deployed
to
github-app-auth
August 27, 2026 07:18 — with
GitHub Actions
Inactive
nissrin2020ali-ux
temporarily deployed
to
github-app-auth
August 27, 2026 07:18 — with
GitHub Actions
Inactive
nissrin2020ali-ux
temporarily deployed
to
github-app-auth
August 27, 2026 07:18 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
Adds OrcaRouter integration samples using Agent Framework’s OpenAI-compatible clients.
Changes:
- Adds Chat Completions and Responses API samples.
- Demonstrates streaming and Chat Completions tool calling.
- Documents OrcaRouter configuration and provider discovery.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
python/samples/02-agents/providers/README.md |
Links the OrcaRouter samples. |
python/samples/02-agents/providers/orcarouter/README.md |
Documents setup and configuration. |
python/samples/02-agents/providers/orcarouter/orcarouter_agent_with_openai_chat_client.py |
Adds a tool-enabled Chat Completions sample. |
python/samples/02-agents/providers/orcarouter/orcarouter_agent_with_responses_client.py |
Adds a Responses API sample. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| def _client() -> OpenAIChatClient: | ||
| """Create an OpenAI Responses client pointed at the OrcaRouter gateway.""" | ||
| return OpenAIChatClient( | ||
| api_key=os.getenv("ORCAROUTER_API_KEY"), |
| def _client() -> OpenAIChatCompletionClient: | ||
| """Create an OpenAI Chat Completion client pointed at the OrcaRouter gateway.""" | ||
| return OpenAIChatCompletionClient( | ||
| api_key=os.getenv("ORCAROUTER_API_KEY"), |
Comment on lines
+43
to
+47
| agent = Agent( | ||
| client=_client(), | ||
| name="Assistant", | ||
| instructions="You are a helpful assistant.", | ||
| ) |
| Set the following environment variables: | ||
|
|
||
| - `ORCAROUTER_API_KEY`: Your OrcaRouter API key | ||
| - `ORCAROUTER_BASE_URL`: The OrcaRouter gateway base URL with `/v1/` suffix (optional, defaults to `https://api.orcarouter.ai/v1`) |
Contributor
|
This is not something we want to add to our repo at the time. Please feel free to host the sample in your own repo. |
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.
Motivation & Context
Adding OrcaRouter as a first-class provider sample lets Microsoft Agent Framework users drive the OrcaRouter gateway directly through the OpenAI-compatible clients they already use, instead of treating it as an anonymous custom base URL.
OrcaRouter is an OpenAI-compatible AI gateway built for both models and agents. Like OpenRouter, it exposes a provider/model namespace across many models — but it also combines adaptive routing, automatic failover, zero-markup inference, observability, guardrails, and agent-tool governance behind the same endpoint. It runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes. Adding
orcarouter/to the provider samples means MAF users can adopt that stack in a single client call.Description & Review Guide
python/samples/02-agents/providers/orcarouter/folder with two runnable samples, plus a link row in the providers overview README.providers/ollama/ollama_with_openai_chat_client.py), and the env-var naming.The samples point the
base_urlofOpenAIChatCompletionClient/OpenAIChatClientathttps://api.orcarouter.ai/v1and pick a gateway model such asorcarouter/fusion. Both cover streaming and tool calling. I verified both samples end-to-end against the gateway — the Chat Completions and the Responses API paths both complete successfully.uv run poe syntax --samples --checkand--formatpass, and type checks report no findings for the new files.Files added:
python/samples/02-agents/providers/orcarouter/README.mdpython/samples/02-agents/providers/orcarouter/orcarouter_agent_with_openai_chat_client.pypython/samples/02-agents/providers/orcarouter/orcarouter_agent_with_responses_client.pyRelated Issue
No related issue.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter
I'm an engineer on the OrcaRouter team.