Skip to content

feat(ai-providers): add OrcaRouter as an AI provider - #7185

Open
Chaitanya-361 wants to merge 1 commit into
decocms:mainfrom
Chaitanya-361:feat/orcarouter-provider
Open

Chaitanya-361 wants to merge 1 commit into
decocms:mainfrom
Chaitanya-361:feat/orcarouter-provider

Conversation

@Chaitanya-361

@Chaitanya-361 Chaitanya-361 commented Sep 14, 2026 •

Copy link
Copy Markdown

What is this contribution about?

Closes #7153

Adds OrcaRouter (https://api.orcarouter.ai) as a selectable AI provider adapter in Studio.
This enables platform teams and agents to route model calls through OrcaRouter without disturbing existing providers (OpenRouter, Anthropic, Google, etc.).

Key changes:

  • apps/api/src/ai-providers/adapters/orcarouter.ts: Created the orcarouterAdapter using @ai-sdk/openai (createOpenAI) with a chat completions compatibility wrapper targeting https://api.orcarouter.ai/v1. Implemented listModels() with conditional Bearer authorization, 30-second timeout, capability remapping (image -> vision), pricing parsing, and token limits clamping (clamping maxOutputTokens to null if equal to or exceeding contextWindow).
  • apps/api/src/ai-providers/adapters/orcarouter.test.ts: Added a comprehensive unit test suite covering provider metadata, header handling (ensuring Authorization is only attached when an API key is provided), full model metadata mapping, capability translation, token limit clamping, and error responses.
  • apps/api/src/ai-providers/types.ts: Exported the OrcaRouterAPIModel interface defining the response schema for OrcaRouter's /v1/models endpoint (including top_provider, architecture, pricing, and context limits).
  • apps/api/src/ai-providers/registry.ts: Imported and registered orcarouterAdapter in getProviders() under the "orcarouter" provider ID.
  • apps/api/src/harnesses/lib/decopilot/studio-provider.ts: Added "orcarouter" to THOUGHT_SIGNATURE_ID_PROVIDERS to decode Gemini thought signatures that gateways pack into tool-call IDs.
  • apps/web/src/views/settings/ai-providers/provider-grid.tsx: Added orcarouter: 2 to CLOUD_ORDER so OrcaRouter renders neatly positioned among cloud providers in the AI Providers settings grid.
  • packages/shared/src/sdk/types/ai-providers.ts: Added "orcarouter" to the HOSTED_PROVIDER_IDS tuple constant.
  • packages/shared/src/tools/tool-io.ts: Regenerated tool IO type contracts to include "orcarouter" across AI provider management tools.

How did you verify your code works?

  • Unit Tests:
    • Ran bun test apps/api/src/ai-providers/adapters/orcarouter.test.ts packages/shared/src/sdk/types/ai-providers.test.ts (10/10 passed).
    • Ran bun test apps/api/src/ai-providers (23/23 passed).
  • Type Checking:
    • Ran tsc --noEmit across apps/api, apps/web, and packages/shared (0 errors).
  • Code Formatting & Linting:
    • Formatted with Biome (biome format).
    • Linted with Oxlint (oxlint).
  • Live / Integration Verification:
    • Verified live model endpoint against https://api.orcarouter.ai/v1/models (retrieving and mapping 195+ models).
    • Verified in local UI at http://localhost:4000/settings/ai-providers that OrcaRouter renders in the provider grid with its logo and branding.

Screenshots/Demonstration

The OrcaRouter tile appears in Settings > AI Providers grid as a cloud provider with direct API key authentication modal.

How to Test

  1. Run bun test apps/api/src/ai-providers/adapters/orcarouter.test.ts to verify adapter unit tests.
  2. Start the local dev server: bun run dev
  3. Navigate to Settings -> AI Providers (/settings/ai-providers).
  4. Locate the OrcaRouter tile and click it to open the API key configuration dialog.
  5. Provide an API key (or test key) to connect OrcaRouter.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Adds OrcaRouter as a selectable AI provider in Studio, letting platform teams and agents route model calls through https://api.orcarouter.ai without affecting existing providers.

New Features

  • The new orcarouterAdapter wraps @ai-sdk/openai to use the chat completions API, which compatible servers support.
  • listModels() maps model metadata, remaps the image input modality to vision, and clamps maxOutputTokens to null when it reaches the context window.
  • OrcaRouter is registered in the provider registry, HOSTED_PROVIDER_IDS, tool IO types, and the settings provider grid.
  • OrcaRouter is added to THOUGHT_SIGNATURE_ID_PROVIDERS so Gemini thought signatures decode correctly.
  • Unit tests cover header handling, model mapping, capability translation, and error responses.

Written for commit bfd6d33. Summary will update on new commits.

Review in cubic

This branch has not been deployed

No deployments
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.

OrcaRouter provider support for deco Studio

1 participant