Skip to content
Open
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: 2 additions & 0 deletions docs/data/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@
url: /providers/hopbase/
- title: Hugging Face
url: /providers/huggingface/
- title: Infer
url: /providers/infer/
- title: Local Models
url: /providers/local/
- title: Lunaroute
Expand Down
147 changes: 147 additions & 0 deletions docs/providers/infer/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
title: "Infer"
description: "Use Infer models with Docker Agent."
keywords: docker agent, ai agents, model providers, llm, infer
weight: 145
canonical: https://docs.docker.com/ai/docker-agent/providers/infer/
---

## Overview

[Infer](https://infer.flow7.org) serves models from Anthropic, OpenAI, Google,
xAI and others through an OpenAI-compatible API. Each model is offered on up to
four routes, and the suffix of the model ID picks the route: `:low-cost`,
`:balanced`, `:stable` or `:official`. Docker Agent includes Infer as a built-in
provider in its embedded provider catalog.

## Setup

1. Create an account and an API key on the
[API keys page](https://infer.flow7.org/app#/keys).
2. Add wallet credit before the first call. Infer is prepaid, and a request the
wallet can't cover returns an `insufficient_credits` error.
3. Set the environment variable:

```bash
export INFER_API_KEY=your-api-key
```

## Usage

### Inline Syntax

Infer model IDs start with `infer/` themselves, as Infer's `/v1/models` and
models.dev list them, so the inline reference repeats the prefix:

```yaml
agents:
root:
model: infer/infer/claude-opus-5-5:low-cost
description: Assistant using Infer
instruction: You are a helpful assistant.
```

Docker Agent splits the inline reference at the first slash, so
`infer/claude-opus-5-5:low-cost` is sent to Infer unchanged and is also the ID
looked up in models.dev.

### Named Model

The `model` value is the model ID exactly as listed:

```yaml
models:
infer_model:
provider: infer
model: infer/claude-opus-5-5:low-cost
max_tokens: 8192

agents:
root:
model: infer_model
description: Assistant using Infer
instruction: You are a helpful assistant.
```

When Infer is selected automatically from available credentials, the default
model is `infer/claude-opus-5-5:low-cost`.

## Available Models

The [models page](https://infer.flow7.org/models) lists every model with its
routes and prices. With a key, `/v1/models` returns the model IDs you can call:

```bash
curl https://infer.flow7.org/v1/models \
-H "Authorization: Bearer $INFER_API_KEY"
```

Use an ID from the response unchanged as the `model` value, for example
`infer/claude-sonnet-5-5:low-cost`, `infer/gpt-6.2-sol:low-cost` or
`infer/grok-4.7:low-cost`. The response also lists image and video generation
models, which can't be used as chat models.

## Pricing and Model Metadata

Infer is in the [models.dev](https://models.dev/) catalog. For the Infer models
that models.dev carries, `docker agent models --provider infer` and the model
picker list them, and Docker Agent reads their prices, context limits and input
types from models.dev, except video (see [Attachments](#attachments)). If
models.dev is unavailable, Docker Agent falls back to its embedded catalog
snapshot.

A model ID that models.dev doesn't list still works. Docker Agent then has no
price or context limit for it, and attachment detection falls back to
text-only; see
[Attachment Capability Overrides](../../configuration/models/index.md#attachment-capability-overrides).

## Attachments

Docker Agent sends Infer requests through Chat Completions, and its Chat
Completions conversion has no content part for video. Some Infer models list
video input in models.dev, but the model picker doesn't show video for Infer
models. A video attachment is dropped with a warning before the request is
sent, so the model never sees it. Setting `capabilities.video: true` on the
model doesn't change this.

## Reasoning and Tool Calls

Infer keeps a model's reasoning across tool calls only when the
`reasoning_details` record from its reply is sent back. Docker Agent sends
earlier reasoning back as `reasoning_content` text instead, so that reasoning
isn't carried over:

- Docker Agent sends no thinking settings for Claude models through this
provider, so `thinking_budget` has no effect on them.
- Without the record, a streamed tool call round trip still completed with
`infer/claude-opus-5-5:low-cost`, `infer/gemini-3.1-pro-preview:official`
and `infer/gemini-3.8-flash:low-cost`: the tool result went back in a second
request and the model used it. Other models weren't checked.

## How It Works

Infer is an entry in Docker Agent's built-in provider catalog
(`pkg/model/provider/catalog/providers.json`) that uses the existing OpenAI
implementation:

- **API type:** OpenAI-compatible Chat Completions (`openai_chatcompletions`)
- **Base URL:** `https://infer.flow7.org/v1`
- **Token variable:** `INFER_API_KEY`

See the [Infer API docs](https://infer.flow7.org/docs) for request options.

## Example: Code Assistant

```yaml
agents:
coder:
model: infer/infer/claude-sonnet-5-5:low-cost
description: Code assistant using Infer
instruction: |
You are an expert programmer.
Write clean code and follow language best practices.
toolsets:
- type: filesystem
- type: shell
- type: think
```
1 change: 1 addition & 0 deletions docs/providers/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Use this table to find a built-in provider's config key and authentication metho
| Straitly | [`straitly`](../straitly/index.md) | `STRAITLY_API_KEY` |
| Morse | [`morse`](../morse/index.md) | `MORSE_API_KEY` |
| UncensoredLabs | [`uncensoredlabs`](../uncensoredlabs/index.md) | `UNCENSOREDLABS_API_KEY` |
| Infer | [`infer`](../infer/index.md) | `INFER_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
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ remote MCP endpoints.
| [`straitly.yaml`](straitly.yaml) | Straitly multi-model gateway (`straitly`). |
| [`morse.yaml`](morse.yaml) | Morse open-weight model provider (`morse`). |
| [`uncensoredlabs.yaml`](uncensoredlabs.yaml) | UncensoredLabs standard and abliterated model provider (`uncensoredlabs`). |
| [`infer.yaml`](infer.yaml) | Infer multi-model API with per-model routes (`infer`). |
| [`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/infer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=../agent-schema.json

models:
infer_model:
provider: infer
model: infer/claude-opus-5-5:low-cost

agents:
root:
model: infer_model
description: Assistant using Infer
instruction: |
You are a helpful assistant.
toolsets:
- type: filesystem
- type: shell
- type: think
16 changes: 16 additions & 0 deletions pkg/config/auto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ func TestAvailableProviders_NoGateway(t *testing.T) {
},
expectedProvider: "uncensoredlabs",
},
{
name: "infer api key present",
envVars: map[string]string{
"INFER_API_KEY": "test-key",
},
expectedProvider: "infer",
},
{
name: "baseten api key present",
envVars: map[string]string{
Expand Down Expand Up @@ -490,6 +497,15 @@ func TestAutoModelConfig(t *testing.T) {
expectedModel: "deepseek-v4.1-flash-fast",
expectedMaxTokens: 32000,
},
{
name: "infer provider",
envVars: map[string]string{
"INFER_API_KEY": "test-key",
},
expectedProvider: "infer",
expectedModel: "infer/claude-opus-5-5:low-cost",
expectedMaxTokens: 32000,
},
{
name: "orcarouter provider",
envVars: map[string]string{
Expand Down
3 changes: 3 additions & 0 deletions pkg/model/provider/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ type Provider struct {
// OpenAIVendor identifies genuine OpenAI model hosts, gating OpenAI-only wire fields.
// Speaking the OpenAI-compatible protocol alone does not qualify.
OpenAIVendor bool `json:"openai_vendor,omitempty"`
// UnsupportedInputModalities lists models.dev input modalities that requests to this
// provider cannot carry, such as video over Chat Completions; the model picker omits them.
UnsupportedInputModalities []string `json:"unsupported_input_modalities,omitempty"`
// Headers supplies default HTTP headers; user http_headers override them case-insensitively.
Headers map[string]string `json:"headers,omitempty"`
// QueryParams maps string-valued provider_opts keys to URL query parameter names.
Expand Down
8 changes: 8 additions & 0 deletions pkg/model/provider/catalog/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ func TestEmbeddedProviders(t *testing.T) {
assert.NotEmpty(t, key)
assert.NotEmpty(t, param)
}
assert.Len(t, slices.Compact(slices.Sorted(slices.Values(alias.UnsupportedInputModalities))), len(alias.UnsupportedInputModalities))
for _, modality := range alias.UnsupportedInputModalities {
switch modality {
case "image", "pdf", "audio", "video":
default:
t.Errorf("unknown unsupported_input_modalities entry %q", modality)
}
}
switch alias.APIFlavor {
case "", APIFlavorOpenAI, APIFlavorOpenAICompatible, APIFlavorGateway:
default:
Expand Down
12 changes: 12 additions & 0 deletions pkg/model/provider/catalog/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@
"UNCENSOREDLABS_API_KEY"
]
},
{
"name": "infer",

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] Registering Infer exposes infer/gemini-3.1-pro-preview:official in the model picker with video input from the embedded snapshot (pkg/runtime/modelcatalog/catalog.go:381–396,455). But the Chat Completions converter drops inline video/* attachments (pkg/model/provider/oaistream/attachments.go:40–73), so the model can answer without ever seeing the clip. Please either send Infer's documented video_url content part and cover it in a request test, or stop advertising video for this integration and document the limitation.

"api_type": "openai",
"base_url": "https://infer.flow7.org/v1",
"default_model": "infer/claude-opus-5-5:low-cost",
"token_env_vars": [
"INFER_API_KEY"
],
"unsupported_input_modalities": [
"video"
]
},
{
"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 @@ -248,6 +248,7 @@ func TestShouldMergeConsecutiveMessages_Gating(t *testing.T) {
{"straitly, no base_url", &latest.ModelConfig{Provider: "straitly", Model: "deepseek/deepseek-v4-1-flash"}, false},
{"morse, no base_url", &latest.ModelConfig{Provider: "morse", Model: "deepseek/deepseek-v4.1-flash"}, false},
{"uncensoredlabs, no base_url", &latest.ModelConfig{Provider: "uncensoredlabs", Model: "deepseek-v4.1-flash-fast"}, false},
{"infer, no base_url", &latest.ModelConfig{Provider: "infer", Model: "infer/claude-opus-5-5:low-cost"}, false},
{"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
8 changes: 8 additions & 0 deletions pkg/model/provider/openai_alias_providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ var openAIAliasProviders = []openAIAliasProvider{
greeting: "Hello from UncensoredLabs",
liveOptInEnvVar: "DOCKER_AGENT_RUN_UNCENSOREDLABS_LIVE_TEST",
},
{
provider: "infer",
envVar: "INFER_API_KEY",
testKey: "test-infer-key",
model: "infer/claude-opus-5-5:low-cost",
greeting: "Hello from Infer",
liveOptInEnvVar: "DOCKER_AGENT_RUN_INFER_LIVE_TEST",
},
{
provider: "deepseek",
envVar: "DEEPSEEK_API_KEY",
Expand Down
18 changes: 16 additions & 2 deletions pkg/runtime/modelcatalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ func (r *Catalog) populateCatalogMetadata(ctx context.Context, choice *ModelChoi
}

// applyCatalogMetadata copies pricing/limit/modality information from a
// models.dev Model entry onto a ModelChoice.
// models.dev Model entry onto a ModelChoice. Input modalities that requests to
// the choice's provider cannot carry are left out, so callers set
// choice.Provider first.
func applyCatalogMetadata(choice *ModelChoice, m *modelsdev.Model) {
if m == nil {
return
Expand All @@ -452,10 +454,22 @@ func applyCatalogMetadata(choice *ModelChoice, m *modelsdev.Model) {
}
choice.ContextLimit = m.Limit.Context
choice.OutputLimit = m.Limit.Output
choice.InputModalities = slices.Clone(m.Modalities.Input)
choice.InputModalities = deliverableInputModalities(choice.Provider, m.Modalities.Input)
choice.OutputModalities = slices.Clone(m.Modalities.Output)
}

// deliverableInputModalities returns a copy of the models.dev input modalities
// without those the provider's catalog entry marks unsupported, so the picker
// never advertises an attachment the request would drop.
func deliverableInputModalities(providerID string, input []string) []string {
unsupported := catalog.Lookup(providerID).UnsupportedInputModalities
return slices.DeleteFunc(slices.Clone(input), func(modality string) bool {
return slices.ContainsFunc(unsupported, func(u string) bool {
return strings.EqualFold(u, modality)
})
})
}

// isEmbeddingModel returns true if the model is an embedding model
// based on its family or name fields from models.dev.
func isEmbeddingModel(family, name string) bool {
Expand Down
52 changes: 52 additions & 0 deletions pkg/runtime/modelcatalog/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func (m *mockCatalogStore) GetDatabase(context.Context) (*modelsdev.Database, er
return m.db, nil
}

func (m *mockCatalogStore) GetModel(_ context.Context, id modelsdev.ID) (*modelsdev.Model, error) {
model, ok := m.db.Providers[id.Provider].Models[id.Model]
if !ok {
return nil, fmt.Errorf("model %q not found", id.String())
}
return &model, nil
}

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

Expand Down Expand Up @@ -505,3 +513,47 @@ func TestBuildCatalogChoices_CanonicalProviders(t *testing.T) {
}
}
}

// TestCatalogMetadata_OmitsUnsupportedInputModalities verifies that the picker
// does not advertise an input modality the provider's requests cannot carry:
// Infer goes through Chat Completions, whose conversion drops video
// attachments, so the video input listed by models.dev is left out for Infer
// models while other providers keep it.
func TestCatalogMetadata_OmitsUnsupportedInputModalities(t *testing.T) {
t.Parallel()

allInputs := []string{"text", "image", "video", "audio", "pdf"}
gemini := modelsdev.Model{
Name: "Gemini 3.1 Pro Preview",
Modalities: modelsdev.Modalities{Input: allInputs, Output: []string{"text"}},
}
r := &Catalog{
Store: &mockCatalogStore{db: &modelsdev.Database{Providers: map[string]modelsdev.Provider{
"infer": {Models: map[string]modelsdev.Model{"infer/gemini-3.1-pro-preview:official": gemini}},
"google": {Models: map[string]modelsdev.Model{"gemini-3.1-pro-preview": gemini}},
}}},
Config: &Config{
EnvProvider: environment.NewMapEnvProvider(map[string]string{
"INFER_API_KEY": "test-key",
"GOOGLE_API_KEY": "test-key",
}),
},
}

inputs := make(map[string][]string)
for _, choice := range r.buildCatalogChoices(t.Context()) {
inputs[choice.Ref] = choice.InputModalities
}
require.Contains(t, inputs, "infer/infer/gemini-3.1-pro-preview:official")
require.Contains(t, inputs, "google/gemini-3.1-pro-preview")
assert.Equal(t, []string{"text", "image", "audio", "pdf"}, inputs["infer/infer/gemini-3.1-pro-preview:official"])
assert.Equal(t, allInputs, inputs["google/gemini-3.1-pro-preview"])

// A configured Infer model is filtered the same way.
configured := ModelChoice{Provider: "infer"}
r.populateCatalogMetadata(t.Context(), &configured, "infer", "infer/gemini-3.1-pro-preview:official")
assert.Equal(t, []string{"text", "image", "audio", "pdf"}, configured.InputModalities)

// The models.dev entry itself is left untouched.
assert.Equal(t, []string{"text", "image", "video", "audio", "pdf"}, gemini.Modalities.Input)
}