Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"properties": {
"provider": {
"type": "string",
"description": "The underlying provider type. Defaults to \"openai\" when not set. Supported values: openai, anthropic, google, amazon-bedrock, dmr, and any built-in alias (requesty, openrouter, opper, runcrate, api-route, lunaroute, orcarouter, atlascloud, popnow, cloudgpu, obscurify, hopbase, azure, xai, ollama, mistral, baseten, daoxe, ovhcloud, groq, fireworks-ai, deepseek, cerebras, togetherai, huggingface, moonshotai, vercel, cloudflare-workers-ai, cloudflare-ai-gateway, nvidia, github-copilot, chatgpt, opencode, opencode-go, etc.).",
"description": "The underlying provider type. Defaults to \"openai\" when not set. Supported values: openai, anthropic, google, amazon-bedrock, dmr, and any built-in alias (requesty, openrouter, opper, runcrate, api-route, lunaroute, orcarouter, atlascloud, popnow, cloudgpu, obscurify, hopbase, trustedrouter, azure, xai, ollama, mistral, baseten, daoxe, ovhcloud, groq, fireworks-ai, deepseek, cerebras, togetherai, huggingface, moonshotai, vercel, cloudflare-workers-ai, cloudflare-ai-gateway, nvidia, github-copilot, chatgpt, opencode, opencode-go, etc.).",
"examples": [
"openai",
"anthropic",
Expand Down
6 changes: 3 additions & 3 deletions docs/configuration/models/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ models:
first_available: [list] # Optional: candidate model refs, tried in order by available credentials.
# Mutually exclusive with other model settings.
provider: string # Required unless using first_available. One of: openai, anthropic, google, amazon-bedrock,
# dmr, mistral, xai, nebius, nvidia, minimax, baseten, daoxe, ovhcloud, groq, fireworks-ai, deepseek, cerebras, togetherai, huggingface, moonshotai, vercel, cloudflare-workers-ai, cloudflare-ai-gateway, requesty, openrouter, opper, runcrate, api-route, lunaroute, orcarouter, atlascloud, popnow, cloudgpu, obscurify, hopbase,
# dmr, mistral, xai, nebius, nvidia, minimax, baseten, daoxe, ovhcloud, groq, fireworks-ai, deepseek, cerebras, togetherai, huggingface, moonshotai, vercel, cloudflare-workers-ai, cloudflare-ai-gateway, requesty, openrouter, opper, runcrate, api-route, lunaroute, orcarouter, atlascloud, popnow, cloudgpu, obscurify, hopbase, trustedrouter,
# azure, ollama, github-copilot, or a named provider defined
# under the top-level `providers:` section.
model: string # Required: model identifier
Expand Down Expand Up @@ -102,7 +102,7 @@ agents:
| Property | Type | Required | Description |
| --------------------- | ---------- | -------- | ------------------------------------------------------------------------------------- |
| `first_available` | array | ✗ | Candidate model references tried in order; selects the first whose credentials are configured. Mutually exclusive with other model settings. |
| `provider` | string | ✓/✗ | Required for regular model definitions; omitted for `first_available` selectors. Provider: `openai`, `anthropic`, `google`, `amazon-bedrock`, `dmr`, `mistral`, `xai`, `nebius`, `nvidia`, `minimax`, `baseten`, `daoxe`, `ovhcloud`, `groq`, `fireworks-ai`, `deepseek`, `cerebras`, `togetherai`, `huggingface`, `moonshotai`, `vercel`, `cloudflare-workers-ai`, `cloudflare-ai-gateway`, `requesty`, `openrouter`, `opper`, `runcrate`, `api-route`, `lunaroute`, `orcarouter`, `atlascloud`, `popnow`, `cloudgpu`, `obscurify`, `hopbase`, `azure`, `ollama`, `github-copilot`, `chatgpt`, `opencode`, `opencode-go`, or any [named provider](../../providers/custom/index.md). |
| `provider` | string | ✓/✗ | Required for regular model definitions; omitted for `first_available` selectors. Provider: `openai`, `anthropic`, `google`, `amazon-bedrock`, `dmr`, `mistral`, `xai`, `nebius`, `nvidia`, `minimax`, `baseten`, `daoxe`, `ovhcloud`, `groq`, `fireworks-ai`, `deepseek`, `cerebras`, `togetherai`, `huggingface`, `moonshotai`, `vercel`, `cloudflare-workers-ai`, `cloudflare-ai-gateway`, `requesty`, `openrouter`, `opper`, `runcrate`, `api-route`, `lunaroute`, `orcarouter`, `atlascloud`, `popnow`, `cloudgpu`, `obscurify`, `hopbase`, `trustedrouter`, `azure`, `ollama`, `github-copilot`, `chatgpt`, `opencode`, `opencode-go`, or any [named provider](../../providers/custom/index.md). |
| `model` | string | ✓/✗ | Required for regular model definitions; omitted for `first_available` selectors. Model name (e.g., `gpt-4o`, `claude-sonnet-4-5`, `gemini-3.5-flash`) |
| `description` | string | ✗ | Informational, human-readable summary of the model's purpose or strengths (e.g., "fast and cheap, good for summaries"). Not sent to the model. Can be combined with `first_available` (a selector's description is kept when it resolves). |
| `stream_idle_timeout` | duration/int | ✗ | Maximum silence between stream chunks; overrides `runtime.stream_idle_timeout`. See [Stream idle timeout](#stream-idle-timeout). |
Expand Down Expand Up @@ -601,7 +601,7 @@ for a complete local-server configuration.
## Custom HTTP Headers

For OpenAI-compatible providers (`openai`, `github-copilot`, `mistral`, `xai`,
`nebius`, `nvidia`, `minimax`, `baseten`, `daoxe`, `ovhcloud`, `groq`, `fireworks-ai`, `deepseek`, `cerebras`, `togetherai`, `huggingface`, `moonshotai`, `vercel`, `cloudflare-workers-ai`, `cloudflare-ai-gateway`, `requesty`, `openrouter`, `opper`, `runcrate`, `lunaroute`, `orcarouter`, `atlascloud`, `popnow`, `cloudgpu`, `obscurify`, `hopbase`, `ollama`, and any custom provider using the OpenAI API),
`nebius`, `nvidia`, `minimax`, `baseten`, `daoxe`, `ovhcloud`, `groq`, `fireworks-ai`, `deepseek`, `cerebras`, `togetherai`, `huggingface`, `moonshotai`, `vercel`, `cloudflare-workers-ai`, `cloudflare-ai-gateway`, `requesty`, `openrouter`, `opper`, `runcrate`, `lunaroute`, `orcarouter`, `atlascloud`, `popnow`, `cloudgpu`, `obscurify`, `hopbase`, `trustedrouter`, `ollama`, and any custom provider using the OpenAI API),
`provider_opts.http_headers` adds arbitrary HTTP headers to every outgoing
request:

Expand Down
2 changes: 2 additions & 0 deletions docs/data/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@
url: /providers/runcrate/
- title: Together AI
url: /providers/together/
- title: TrustedRouter
url: /providers/trustedrouter/
- title: Vercel AI Gateway
url: /providers/vercel/
- title: "xAI (Grok)"
Expand Down
1 change: 1 addition & 0 deletions docs/providers/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Use this table to find a built-in provider's config key and authentication metho
| CloudGPU | [`cloudgpu`](../cloudgpu/index.md) | `CLOUDGPU_API_KEY` |
| Obscurify.ai | [`obscurify`](../obscurify/index.md) | `OBSCURIFY_API_KEY` |
| HopBase | [`hopbase`](../hopbase/index.md) | `HOPBASE_API_KEY` |
| TrustedRouter | [`trustedrouter`](../trustedrouter/index.md) | `TRUSTEDROUTER_API_KEY` |
| Azure OpenAI | `azure` | `AZURE_API_KEY` + `base_url` (override the key with `token_key`) |
| [Ollama](../local/index.md) | `ollama` | None (local; optional `base_url`) |
| GitHub Copilot | `github-copilot` | `GITHUB_TOKEN` or `GH_TOKEN` (PAT with `copilot` scope) |
Expand Down
80 changes: 80 additions & 0 deletions docs/providers/trustedrouter/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: "TrustedRouter"
description: "Use TrustedRouter models with Docker Agent."
keywords: docker agent, ai agents, model providers, llm, trustedrouter
weight: 255
canonical: https://docs.docker.com/ai/docker-agent/providers/trustedrouter/
---

_Use TrustedRouter models with Docker Agent._

## Overview

[TrustedRouter](https://trustedrouter.com) is an OpenAI-compatible router that
serves models from multiple upstream providers through attested
(confidential-computing) gateways. Docker Agent includes built-in support for
TrustedRouter as an alias provider. Current model IDs are on the public
[model list](https://api.trustedrouter.com/v1/models).

## Setup

1. Create an API key at [trustedrouter.com](https://trustedrouter.com). Keys are
prefixed with `sk-tr-v1-`.
2. Set the environment variable:

```bash
export TRUSTEDROUTER_API_KEY=sk-tr-v1-your-api-key
```

## Usage

### Inline Syntax

The first `trustedrouter/` selects the provider; the rest is the TrustedRouter
model ID, which is always vendor-prefixed:

```yaml
agents:
root:
model: trustedrouter/trustedrouter/auto
description: Assistant using TrustedRouter
instruction: You are a helpful assistant.
```

For an upstream model, add the provider prefix to the ID from the model list:
the model list shows `anthropic/claude-sonnet-4.5`, so the inline reference is
`trustedrouter/anthropic/claude-sonnet-4.5`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[blocking] The linked /v1/models list advertises anthropic/claude-sonnet-4.5, not trustedrouter/anthropic/claude-sonnet-4.5, as the upstream model ID. The latter is the Docker Agent inline reference: pkg/config/latest/model_ref.go:17 strips only the first trustedrouter/, and pkg/model/provider/openai/client.go:391 sends the remainder verbatim. If a reader copies the documented ID into a named model or adds the provider prefix again for inline use, the request sends an unlisted ID. Please show both forms explicitly: inline trustedrouter/anthropic/claude-sonnet-4.5, or named provider: trustedrouter with model: anthropic/claude-sonnet-4.5. The trustedrouter/trustedrouter/auto example is correct because that route's raw ID is trustedrouter/auto.

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 in 98038cb: the Inline section now says the model list ID is anthropic/claude-sonnet-4.5 and the inline reference is trustedrouter/anthropic/claude-sonnet-4.5; the Named Model section says model takes the model list ID as is (provider: trustedrouter, model: anthropic/claude-sonnet-4.5).


### Named Model

```yaml
models:
trustedrouter_model:
provider: trustedrouter
model: trustedrouter/auto

agents:
root:
model: trustedrouter_model
instruction: You are a helpful assistant.
```

In a named model, `model` is the ID from the model list as is, without the
provider prefix: for example `provider: trustedrouter` with
`model: anthropic/claude-sonnet-4.5`.

When TrustedRouter is selected automatically from available credentials, the
default model is `trustedrouter/auto`. Other routes include
`trustedrouter/cheap` and `trustedrouter/fast`.

## How it works

Requests use OpenAI-compatible Chat Completions at
`https://api.trustedrouter.com/v1` with `TRUSTEDROUTER_API_KEY`. Context limits
and capabilities come from the embedded models.dev catalog. The catalog has no
pricing for TrustedRouter routes, so set `cost` on a model to track spend (see
[Custom Token Pricing](../../configuration/models/index.md#custom-token-pricing)).
When a Docker Agent models gateway is configured, the built-in alias
routes through that gateway instead; set `bypass_models_gateway: true` on a named
model to call TrustedRouter directly. See
[Gateway Bypass](../../configuration/models/index.md#gateway-bypass).
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ remote MCP endpoints.
| [`cloudgpu.yaml`](cloudgpu.yaml) | CloudGPU OpenAI-compatible provider (`cloudgpu`). |
| [`obscurify.yaml`](obscurify.yaml) | Obscurify.ai multi-model provider (`obscurify`). |
| [`hopbase.yaml`](hopbase.yaml) | HopBase multi-model gateway (`hopbase`). |
| [`trustedrouter.yaml`](trustedrouter.yaml) | TrustedRouter OpenAI-compatible router (`trustedrouter`). |
| [`cloudflare-workers-ai.yaml`](cloudflare-workers-ai.yaml) | Cloudflare Workers AI edge-hosted open models. |
| [`cloudflare-ai-gateway.yaml`](cloudflare-ai-gateway.yaml) | Cloudflare AI Gateway multi-provider router. |
| [`grok.yaml`](grok.yaml) | xAI Grok model. |
Expand Down
17 changes: 17 additions & 0 deletions examples/trustedrouter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=../agent-schema.json

models:
trustedrouter_model:
provider: trustedrouter
model: trustedrouter/auto

agents:
root:
model: trustedrouter_model
description: Assistant using TrustedRouter
instruction: |
You are a helpful assistant.
toolsets:
- type: filesystem
- type: shell
- type: think
21 changes: 20 additions & 1 deletion pkg/config/auto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ func TestAvailableProviders_NoGateway(t *testing.T) {
},
expectedProvider: "hopbase",
},
{
name: "trustedrouter api key present",
envVars: map[string]string{
"TRUSTEDROUTER_API_KEY": "test-key",
},
expectedProvider: "trustedrouter",
},
{
name: "baseten api key present",
envVars: map[string]string{
Expand Down Expand Up @@ -417,6 +424,15 @@ func TestAutoModelConfig(t *testing.T) {
expectedModel: "deepseek-v4.1-flash",
expectedMaxTokens: 32000,
},
{
name: "trustedrouter provider",
envVars: map[string]string{
"TRUSTEDROUTER_API_KEY": "test-key",
},
expectedProvider: "trustedrouter",
expectedModel: "trustedrouter/auto",
expectedMaxTokens: 32000,
},
{
name: "lunaroute provider",
envVars: map[string]string{"LUNAROUTE_API_KEY": "lr_test"},
Expand Down Expand Up @@ -653,6 +669,7 @@ func TestDefaultModels(t *testing.T) {
assert.Equal(t, "orcarouter/auto", DefaultModels["orcarouter"])
assert.Equal(t, "glm-5.3", DefaultModels["lunaroute"])
assert.Equal(t, "deepseek-v4.1-flash", DefaultModels["cloudgpu"])
assert.Equal(t, "trustedrouter/auto", DefaultModels["trustedrouter"])
assert.Equal(t, "qwen/qwen3.8-max", DefaultModels["atlascloud"])
assert.Equal(t, "deepseek/v4-flash/chat", DefaultModels["popnow"])
assert.Equal(t, "deepseek-ai/DeepSeek-V4-Pro-0813", DefaultModels["baseten"])
Expand All @@ -674,7 +691,7 @@ func TestAutoModelConfig_IntegrationWithDefaultModels(t *testing.T) {
t.Parallel()

// Verify that AutoModelConfig always returns a model from DefaultModels
providers := []string{"openai", "anthropic", "google", "mistral", "openrouter", "api-route", "orcarouter", "atlascloud", "popnow", "cloudgpu", "baseten", "ovhcloud", "groq", "fireworks-ai", "deepseek", "cerebras", "togetherai", "huggingface", "moonshotai", "vercel", "opencode", "github-copilot"}
providers := []string{"openai", "anthropic", "google", "mistral", "openrouter", "api-route", "orcarouter", "atlascloud", "popnow", "cloudgpu", "trustedrouter", "baseten", "ovhcloud", "groq", "fireworks-ai", "deepseek", "cerebras", "togetherai", "huggingface", "moonshotai", "vercel", "opencode", "github-copilot"}

for _, provider := range providers {
t.Run(provider, func(t *testing.T) {
Expand Down Expand Up @@ -706,6 +723,8 @@ func TestAutoModelConfig_IntegrationWithDefaultModels(t *testing.T) {
envVars["POPNOW_API_KEY"] = "test-key"
case "cloudgpu":
envVars["CLOUDGPU_API_KEY"] = "test-key"
case "trustedrouter":
envVars["TRUSTEDROUTER_API_KEY"] = "test-key"
case "baseten":
envVars["BASETEN_API_KEY"] = "test-key"
case "ovhcloud":
Expand Down
28 changes: 28 additions & 0 deletions pkg/config/trustedrouter_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package config

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/docker/docker-agent/pkg/config/latest"
"github.com/docker/docker-agent/pkg/environment"
)

func TestTrustedRouterRequiredCredentials(t *testing.T) {
t.Parallel()

cfg := &latest.Config{
Agents: []latest.AgentConfig{{Name: "root", Model: "trustedrouter/trustedrouter/auto"}},
Models: map[string]latest.ModelConfig{
"trustedrouter/trustedrouter/auto": {Provider: "trustedrouter", Model: "trustedrouter/auto"},
},
}
err := CheckRequiredEnvVars(t.Context(), cfg, "", environment.NewNoEnvProvider())
var required *environment.RequiredEnvError
require.ErrorAs(t, err, &required)
assert.Equal(t, []string{"TRUSTEDROUTER_API_KEY"}, required.Missing)
assert.True(t, required.MissingModelCredentials)
require.NoError(t, CheckRequiredEnvVars(t.Context(), cfg, "", environment.NewMapEnvProvider(map[string]string{"TRUSTEDROUTER_API_KEY": "test-key"})))
}
10 changes: 10 additions & 0 deletions pkg/model/provider/catalog/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@
"HOPBASE_API_KEY"
]
},
{
"name": "trustedrouter",
"merge_consecutive_messages": true,
"api_type": "openai",
"base_url": "https://api.trustedrouter.com/v1",
"default_model": "trustedrouter/auto",
"token_env_vars": [
"TRUSTEDROUTER_API_KEY"
]
},
{
"name": "baseten",
"merge_consecutive_messages": true,
Expand Down
1 change: 1 addition & 0 deletions pkg/model/provider/openai/system_message_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ func TestShouldMergeConsecutiveMessages_Gating(t *testing.T) {
{"cloudgpu, no base_url", &latest.ModelConfig{Provider: "cloudgpu", Model: "deepseek-v4.1-flash"}, true},
{"obscurify, no base_url", &latest.ModelConfig{Provider: "obscurify", Model: "deepseek/deepseek-v4-flash"}, true},
{"hopbase, no base_url", &latest.ModelConfig{Provider: "hopbase", Model: "glm-5.3"}, true},
{"trustedrouter, no base_url", &latest.ModelConfig{Provider: "trustedrouter", Model: "trustedrouter/auto"}, true},
{"ovhcloud", &latest.ModelConfig{Provider: "ovhcloud", Model: "Qwen3.5-397B-A17B"}, true},
{"open-model host alias cerebras", &latest.ModelConfig{Provider: "cerebras", Model: "qwen-3-coder-480b"}, true},
{"open-model host fireworks", &latest.ModelConfig{Provider: "fireworks", Model: "accounts/fireworks/models/kimi-k3"}, true},
Expand Down
9 changes: 9 additions & 0 deletions pkg/model/provider/openai_alias_providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ var openAIAliasProviders = []openAIAliasProvider{
mergesSystemMessages: true,
liveOptInEnvVar: "DOCKER_AGENT_RUN_HOPBASE_LIVE_TEST",
},
{
provider: "trustedrouter",
envVar: "TRUSTEDROUTER_API_KEY",
testKey: "sk-tr-v1-test-key",
model: "trustedrouter/auto",
greeting: "Hello from TrustedRouter",
mergesSystemMessages: true,
Comment thread
Copilot marked this conversation as resolved.
Resolved
liveOptInEnvVar: "DOCKER_AGENT_RUN_TRUSTEDROUTER_LIVE_TEST",
},
{
provider: "deepseek",
envVar: "DEEPSEEK_API_KEY",
Expand Down
Loading