Skip to content

feat(ai): add OpenRouter session routing and Responses transport - #818

Open
paralin wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
paralin:feat/openrouter-responses-transport
Open

feat(ai): add OpenRouter session routing and Responses transport#818
paralin wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
paralin:feat/openrouter-responses-transport

Conversation

@paralin

@paralin paralin commented Aug 7, 2026

Copy link
Copy Markdown

Send Prime’s opaque session identifier as OpenRouter’s session_id so Chat Completions requests from one session share dashboard grouping and sticky upstream routing.

Add a default-off openRouter.responses setting that selects OpenRouter’s stateless Responses transport on each provider request. The Responses path keeps the session ID, prompt cache key, provider routing, tools, and reasoning settings. It falls back to Chat Completions only when the Responses endpoint is unavailable before streaming starts; authentication, rate-limit, context, cancellation, and post-start failures stay on the selected transport.

Verified the changed AI provider paths with 17 focused tests and the settings path with 34 focused tests. npm run check also passes, including Biome, TypeScript, installer rendering, and the browser smoke check.

Note

Add OpenRouter session routing and Responses transport with Chat Completions fallback

  • Adds session_id to OpenRouter Chat Completions and Responses requests, populated from options.sessionId, for dashboard grouping and sticky routing.
  • Introduces a new openRouterResponses option in SimpleStreamOptions that routes OpenRouter requests through the stateless Responses transport instead of Chat Completions.
  • When openRouterResponses is enabled, a streamOpenRouterResponsesWithChatFallback helper automatically falls back to Chat Completions if the Responses transport fails before streaming begins (e.g. 404, 405, 501, or unsupported endpoint).
  • Adds a getOpenRouterResponses() getter in settings-manager.ts reading from openRouter.responses (default false), wired into the agent session in sdk.ts.
  • Behavioral Change: OpenRouter Responses requests now include tool call support and optional provider routing preferences via compat.openRouterRouting.

Macroscope summarized f70cd58.

Signed-off-by: Christian Stewart <christian@aperture.us>
@paralin
paralin force-pushed the feat/openrouter-responses-transport branch from 076a522 to f70cd58 Compare August 12, 2026 22:27
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