Skip to content

feat: add OpenRouter provider - #3337

Merged
Sayt-0 merged 2 commits into
docker:mainfrom
dgageot:worktree-board-332dddf81975481f
Jun 30, 2026
Merged

Sayt-0 merged 2 commits into
docker:mainfrom
dgageot:worktree-board-332dddf81975481f

Conversation

@dgageot

@dgageot dgageot commented Jun 30, 2026

Copy link
Copy Markdown
Member

OpenRouter is an increasingly popular gateway that exposes hundreds of models through a single OpenAI-compatible endpoint, but users had to configure it manually as a custom provider. This change registers it as a first-class built-in alias so the experience is as smooth as Anthropic or Groq.

When OPENROUTER_API_KEY is set, the provider is auto-detected, its base URL (https://openrouter.ai/api/v1) is resolved automatically, and it surfaces in default/env/sandbox paths the same way every other built-in provider does. The fake proxy gains a URL-rewrite rule so that paths containing /api are preserved correctly — previously the rewrite stripped the /api segment, breaking OpenRouter requests in tests. A new example config (examples/openrouter.yaml) and a dedicated docs page round out the addition so users can get started without reading source code.

No breaking changes. Existing custom-provider configurations that pointed at https://openrouter.ai/api/v1 continue to work unchanged.

@dgageot
dgageot requested a review from a team as a code owner June 30, 2026 16:53

@docker-agent docker-agent 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.

Assessment: 🟡 NEEDS ATTENTION

The OpenRouter provider integration is well-structured and consistent with other providers across the codebase. One area to verify before merging: the sandbox env-var handling.

Comment thread pkg/sandbox/sandbox.go
"ANTHROPIC_API_KEY",
"GOOGLE_API_KEY",
"MISTRAL_API_KEY",
"OPENROUTER_API_KEY",

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.

[MEDIUM] OPENROUTER_API_KEY added to proxyManagedEnvVars — verify Docker Desktop proxy support exists

proxyManagedEnvVars is an exclusion list: keys in it are never forwarded to the sandbox container because Docker Desktop's built-in proxy is expected to inject them automatically. Adding OPENROUTER_API_KEY here silently drops the key from the sandbox environment unless Docker Desktop already handles it.

If Desktop proxy support for OpenRouter is not yet live, every sandbox run that uses OpenRouter will fail with 401 Unauthorized with no clear indication of the cause — the key just won't be present inside the container.

All the other entries in the list (OpenAI, Anthropic, Google, Mistral, xAI, Nebius) have confirmed Desktop proxy backing. Before merging, confirm that the same support exists for OPENROUTER_API_KEY, or consider deferring this addition until Desktop proxy coverage is verified.

@Sayt-0
Sayt-0 merged commit 3c834da into docker:main Jun 30, 2026
10 of 11 checks passed
@dgageot
dgageot deleted the worktree-board-332dddf81975481f branch June 30, 2026 17:01
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
docker-agent 1.93.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>This release adds OpenRouter as a built-in provider, introduces per-model gateway bypass support, and allows a dedicated model for session compaction, alongside several internal refactoring improvements.

## What's New
- Adds OpenRouter as a first-class built-in provider; when `OPENROUTER_API_KEY` is set, the provider is auto-detected and its base URL resolved automatically
- Adds a `compaction_model` field to allow a dedicated model for session summary generation, separate from the primary agent model
- Adds a `bypass_models_gateway` boolean field on a per-model basis, allowing specific models to connect directly to their provider instead of routing through the configured models gateway

## Technical Changes
- Replaces mutex usage with atomic types (`atomic.Bool`, `atomic.Pointer`) for single mutable fields in several structs
- Replaces package-level global variables with explicit parameters or struct fields to enable parallel-safe testing across several packages (`toolinstall`, `runtime`, `mcp`, `notification`, `tui`, `cmd/root`)
- Adds a concurrency group to the PR review trigger CI workflow to prevent duplicate reviews for the same PR
---

## What's Changed
* docs: update CHANGELOG.md for v1.92.0 by @docker-read-write[bot] in docker/docker-agent#3331
* refactor: replace single-variable mutexes with atomic types by @dgageot in docker/docker-agent#3330
* ci: add concurrency group to pr-review-trigger to prevent duplicate reviews by @derekmisler in docker/docker-agent#3334
* refactor: replace test-overridden globals with parallel-safe injection by @dgageot in docker/docker-agent#3332
* feat(compaction): allow a dedicated model for session summary generation by @Sayt-0 in docker/docker-agent#3335
* feat: add OpenRouter provider by @dgageot in docker/docker-agent#3337
* feat: add per-model bypass_models_gateway option by @dgageot in docker/docker-agent#3338


**Full Changelog**: docker/docker-agent@v1.92.0...v1.93.0
</pre>
  <p>View the full release notes at <a href="https://github.com/docker/docker-agent/releases/tag/v1.93.0">https://github.com/docker/docker-agent/releases/tag/v1.93.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!13152
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