feat: add first-class OpenRouter provider support - #1975
Conversation
1b84513 to
5baa132
Compare
|
Carl (AI agent) commenting on Wes’s behalf. Re-reviewed the current PR head, Concrete production regressions still present in the current diff:
CI being green does not make these reversions safe: the reverted implementations previously passed CI, and this branch deletes several of the regression tests that would catch them. The OpenRouter-specific implementation itself looks careful and has strong coverage, but it needs to be rebuilt/rebased so the PR preserves current Requested change: replace this head with a clean OpenRouter-only diff on current |
5baa132 to
7ca120a
Compare
|
Carl (AI agent) commenting on Wes’s behalf. Re-review update: the earlier blocking comment is fully resolved at head
No remaining review findings from me. The optional comment documenting Anthropic’s four-cache-breakpoint ceiling remains a maintenance nit only and should not block this PR. |
Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
7ca120a to
c099f32
Compare
…-style * origin/main: feat: add first-class OpenRouter provider support (block#1975) feat(agent,acp): wire provider total_tokens through NIP-AM publish chain (block#3593) Co-authored-by: Amp <amp@ampcode.com> Signed-off-by: Joah Gerstenberg <joah@squareup.com> Amp-Thread-ID: https://ampcode.com/threads/T-019fabca-7cdc-777d-9ccd-ed829c1e60f0 # Conflicts: # desktop/src-tauri/src/commands/agent_models.rs
* origin/main: (29 commits) feat(replica): portable heartbeat-token fence with snapshot-local reader routing (#3268) fix(git): channel binding tooling + author remediation for unbound repos (#3626) feat: configure S3 URL addressing style (#3400) feat: add first-class OpenRouter provider support (#1975) feat(agent,acp): wire provider total_tokens through NIP-AM publish chain (#3593) chore(release): release Buzz Desktop version 0.5.2 (#3624) docs: add Linux rendering troubleshooting guide (#3573) fix(desktop): discover bun-installed agent CLIs in ~/.bun/bin (#3343) feat(tracing): correlate trace IDs in relay logs (#3608) chore(ci): bump Linux AppImage build container to ubuntu:24.04 (#3602) feat(cli): mirror Desktop mention delivery (#3330) fix(desktop): deduplicate relay outage notification (#3579) fix(desktop): reconcile thread arrivals at bottom (#3585) fix(mobile): keep TLS on relays joined by invite (#3139) Improve emoji autocomplete matching (#3571) Fix shared agent avatar import profiles (#3578) Fix inline raster avatars in agent catalog (#3581) revert(acp): remove dead GOOSE_ACP_SCHEDULER_DISABLED env injection (#3576) feat(agent): make Gemini and MLflow-route models usable through databricks_v2 (#3569) fix(cli): mask credential env values in --help output (#3570) ... Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
…chive * origin/main: (22 commits) feat(catalog): resolve publisher display name in catalog detail pane (#3640) feat(mesh): upgrade embedded mesh to v0.74 and harden shared compute (split 1/2 of #3467) (#3741) docs(nips): specify kind:30621 multi-repo projects (NIP-MP) (#3163) Refine agent sharing dialog (#3699) desktop: enable getUserMedia in the Linux WebKitGTK webview (#3607) fix: align responsive agent views (#3688) Add macOS agent menu-bar menu (#3565) Fix pending message feedback (#3543) fix(desktop): remove remaining Projects panel fills (#3742) feat(mobile): desktop-parity emoji and thread experience (#3485) desktop: restore direct community member adds (#3634) fix(desktop): explain open agent access (#2561) fix(cli): resolve agents from owner records (#3178) fix(desktop): remove Projects overview card fills (#3416) feat(replica): portable heartbeat-token fence with snapshot-local reader routing (#3268) fix(git): channel binding tooling + author remediation for unbound repos (#3626) feat: configure S3 URL addressing style (#3400) feat: add first-class OpenRouter provider support (#1975) feat(agent,acp): wire provider total_tokens through NIP-AM publish chain (#3593) chore(release): release Buzz Desktop version 0.5.2 (#3624) ... Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
…g-pipeline * origin/main: (25 commits) Refine agent sharing dialog (#3699) desktop: enable getUserMedia in the Linux WebKitGTK webview (#3607) fix: align responsive agent views (#3688) Add macOS agent menu-bar menu (#3565) Fix pending message feedback (#3543) fix(desktop): remove remaining Projects panel fills (#3742) feat(mobile): desktop-parity emoji and thread experience (#3485) desktop: restore direct community member adds (#3634) fix(desktop): explain open agent access (#2561) fix(cli): resolve agents from owner records (#3178) fix(desktop): remove Projects overview card fills (#3416) feat(replica): portable heartbeat-token fence with snapshot-local reader routing (#3268) fix(git): channel binding tooling + author remediation for unbound repos (#3626) feat: configure S3 URL addressing style (#3400) feat: add first-class OpenRouter provider support (#1975) feat(agent,acp): wire provider total_tokens through NIP-AM publish chain (#3593) chore(release): release Buzz Desktop version 0.5.2 (#3624) docs: add Linux rendering troubleshooting guide (#3573) fix(desktop): discover bun-installed agent CLIs in ~/.bun/bin (#3343) feat(tracing): correlate trace IDs in relay logs (#3608) ... Signed-off-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
…-diff-ui * origin/duncan/restart-diff-rust-core: test(desktop): pin the unstamped-agent restart-diff invariant feat(desktop): show which config fields need a restart fix(git): channel binding tooling + author remediation for unbound repos (#3626) feat: configure S3 URL addressing style (#3400) feat: add first-class OpenRouter provider support (#1975) Signed-off-by: npub1g8493u0xfsjrvflg4n08ezd7vec99mnwzlv0qgwpr9d7gvjwhuzqx59rhw <41ea58f1e64c243627e8acde7c89be667052ee6e17d8f021c1195be4324ebf04@buzz.block.builderlab.xyz>
Summary
First-class
Provider::OpenRoutersupport joining the existing anthropic/openai/databricks providers. Reuses the Chat Completions path with targeted mutations for OpenRouter's routing contract.Core (
crates/buzz-agent):Provider::OpenRouterenum variant withOPENROUTER_API_KEY,BUZZ_AGENT_MODEL→OPENROUTER_MODELfallback,OPENROUTER_BASE_URLenv conventionreasoning: {effort}when effort is configured, andmax_completion_tokenstranslated to OpenRouter'smax_tokensspelling; noprovider.require_parametersfilter (it routes only to endpoints advertising every parameter in the body, which hard-404s a valid model id); summaries get neither.openai_bodyis always called witheffort=Noneon the OpenRouter path — thereasoningobject is added by the mutator directly, soreasoning_effortis structurally absent.HTTP-Referer: https://github.com/block/buzz,X-OpenRouter-Title: Buzzparse_openai(finish_reason == "error")refresh_nowreturns the same token) fail terminal immediately with one wire request; PKCE/minting sources get one retry with the fresh token.error_typeretry matrix (4-arm collapsed form): 429 (honorRetry-After), 502 (retry), 503/provider_overloaded(honorRetry-After), everything else including untyped 503 (bounded retries → actionable routing message). 499 included matching sharedpost()(fix(timeout): unified turn-timeout fix — cap inheritance, steer renewal, activity-aware requeue, LLM stall surfacing #2175) for turn-timeout stall surfacing. Terminal failures wrapped interminal_llm_errorfor duration+attempt-count context.anthropic/*cache_controlinjection (model-gated, mixed-content safe)reasoning_detailsopaque round-trip onHistoryItem::Assistantfor tool-call continuations — captured verbatim inparse_openai_with_reasoning_details, replayed verbatim inopenai_body, byte-accounting charged.provider_extrapassthrough frommake_tool_callcomposes independently.Desktop:
OPENROUTER_API_KEY+OPENROUTER_MODEL{OPENROUTER_BASE_URL}/modelsfiltered onsupported_parameterscontainstoolsdesktop/src/features/agents/AGENTS.md: no rules changed — the scoped rule requiring an explicit note is satisfied here.Implements the gate-cleared plan from
PLANS/OPENROUTER_PROVIDER_PLAN.md(rev 3).