Repository navigation
feat: add API Route as an OpenAI-compatible provider alias #4567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DennyHo0917
wants to merge
1
commit into
docker:main
Choose a base branch
from
DennyHo0917:feat/api-route-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+157
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --- | ||
| title: "API Route" | ||
| description: "Use API Route models with Docker Agent." | ||
| keywords: docker agent, ai agents, model providers, llm, api route | ||
| weight: 23 | ||
| canonical: https://docs.docker.com/ai/docker-agent/providers/api-route/ | ||
| --- | ||
|
|
||
| _Use API Route models with Docker Agent._ | ||
|
|
||
| ## Overview | ||
|
|
||
| [API Route](https://api-route.com) provides access to multiple model families | ||
| through an OpenAI-compatible API. Docker Agent includes API Route as a built-in | ||
| alias provider using the global endpoint. | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Create an API key in your [API Route account](https://api-route.com). | ||
| 2. Set the environment variable: | ||
|
|
||
| ```bash | ||
| export API_ROUTE_API_KEY=your-api-key | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Inline Syntax | ||
|
|
||
| ```yaml | ||
| agents: | ||
| root: | ||
| model: api-route/gpt-6.1-sol | ||
| description: Assistant using API Route | ||
| instruction: You are a helpful assistant. | ||
| ``` | ||
|
|
||
| ### Named Model | ||
|
|
||
| ```yaml | ||
| models: | ||
| api_route_model: | ||
| provider: api-route | ||
| model: gpt-6.1-sol | ||
|
|
||
| agents: | ||
| root: | ||
| model: api_route_model | ||
| description: Assistant using API Route | ||
| instruction: You are a helpful assistant. | ||
| ``` | ||
|
|
||
| ## Available Models | ||
|
|
||
| The examples use the exact model ID `gpt-6.1-sol`. Retrieve your account's current | ||
| model IDs before choosing another model: | ||
|
|
||
| ```bash | ||
| curl https://global.api-route.com/v1/models \ | ||
| -H "Authorization: Bearer $API_ROUTE_API_KEY" | ||
| ``` | ||
|
|
||
| Use an ID from the response unchanged as the `model` value. A catalog listing | ||
| does not guarantee that inference is currently available. | ||
|
|
||
| API Route is absent from Docker Agent's embedded models.dev catalog. Docker | ||
| Agent does not import pricing, context limits or attachment capabilities from | ||
| API Route's model list. Attachment detection falls back to text-only, so image | ||
| and PDF attachments are dropped with a warning. If you have verified support | ||
| for an attachment type on your chosen model and endpoint, set | ||
| `models.<name>.capabilities`; see | ||
| [Attachment Capability Overrides](../../configuration/models/index.md#attachment-capability-overrides). | ||
|
|
||
| ## How It Works | ||
|
|
||
| - **API type:** OpenAI-compatible Chat Completions (`openai_chatcompletions`) | ||
| - **Base URL:** `https://global.api-route.com/v1` | ||
| - **Token variable:** `API_ROUTE_API_KEY` | ||
|
|
||
| As with other multi-model hosts, Docker Agent combines consecutive system | ||
| messages for compatibility with models that require a single leading system | ||
| message. | ||
|
|
||
| ## Example: Code Assistant | ||
|
|
||
| ```yaml | ||
| agents: | ||
| coder: | ||
| model: api-route/gpt-6.1-sol | ||
| description: Code assistant using API Route | ||
| instruction: | | ||
| You are an expert programmer. | ||
| Write clean code and follow language best practices. | ||
| toolsets: | ||
| - type: filesystem | ||
| - type: shell | ||
| - type: think | ||
| ``` |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # yaml-language-server: $schema=../agent-schema.json | ||
|
|
||
| models: | ||
| api_route_model: | ||
| provider: api-route | ||
| model: gpt-6.1-sol | ||
|
|
||
| agents: | ||
| root: | ||
| model: api_route_model | ||
| description: Assistant using API Route | ||
| instruction: You are a helpful assistant. | ||
| toolsets: | ||
| - type: filesystem | ||
| - type: shell | ||
| - type: think |
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F1 (medium): require an explicit opt-in before live inference. This row is also consumed by
TestOpenAIAliasProvider_LiveAPI(lines 308–339), which skips only if the credential is absent and then sends a real streamed completion to the built-in endpoint. A contributor who exportsAPI_ROUTE_API_KEYas documented and runs ordinarytask testorgo test ./...can therefore incur paid inference and network/balance-dependent failures without opting into a live test.The key-only live-test mechanism predates this PR; this row expands it to API Route. The prior review's safe Task 3.53.1 fake-Go sentinel probe confirmed that exported credentials survive dotenv, so adding an empty
.env.testentry alone is insufficient. No live inference was executed for this review.Please require a separate explicit live-test opt-in, at least for this new provider's live subtest, while keeping mock tests unconditional. Add a regression that verifies credential alone does not enable live inference, without contacting a real backend.