Skip to content

feat(openrouter): support native Anthropic Messages - #41

Closed
gptphew[bot] wants to merge 1 commit into
mainfrom
feat/openrouter-messages
Closed

gptphew[bot] wants to merge 1 commit into
mainfrom
feat/openrouter-messages

Conversation

@gptphew

@gptphew gptphew Bot commented Sep 28, 2026

Copy link
Copy Markdown

Problem

The gateway supports OpenRouter chat completions but cannot route Anthropic Messages to OpenRouter. This prevents Messages-based transient-error failover from using OpenRouter as a target.

Change

  • Route OpenRouter Messages to the documented native /api/v1/messages endpoint with bearer auth.
  • Preserve Anthropic tool use/replay, thinking, SSE frames, and OpenRouter provider privacy preferences. Exclude Anthropic-only container and mcp_servers fields that the OpenRouter request schema does not accept.
  • Validate nonstreaming successes, preserve typed provider errors, and exercise emitted requests and response handling in synthetic offline tests.

Verification

  • node --import tsx --test src/providers/openrouter/messages.offline.ts: 6 passed.
  • npx prettier --check src/providers/openrouter/{api.ts,index.ts,messages.ts,messages.offline.ts}: passed.
  • npx tsc --noEmit --pretty false: blocked by existing top-level-await CommonJS errors in src/utils/env.ts, reproduced on unmodified base.

No paid live inference or production traffic was started. Live OpenRouter model compatibility and failover behavior remain unverified pending authorized integration tests. This PR does not implement or alter gateway retry policy; it adds the OpenRouter Messages target.

@gptphew
gptphew Bot requested a review from arnavsurve September 28, 2026 19:15
@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
gateway Error Error Sep 28, 2026 7:16pm UTC

Request Review

Co-authored-by: Arnav Surve <arnav@anything.com>

This branch had an error being deployed

1 failed deployment
Preview — 2ab8f67b Deployed Sep 28, 2026 by vercel[bot]
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.

1 participant