feat: add OrcaRouter provider support and update context windows:#219
Conversation
- Introduced OrcaRouterService for handling interactions with the OrcaRouter API. - Updated context windows to include new models from OrcaRouter and adjusted pricing for existing models. - Enhanced provider management to support OrcaRouter in connection and model selection processes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (7)
Disabled knowledge base sources:
WalkthroughAdds OrcaRouter as a configurable, selectable AI provider with streaming and tool-aware request handling. It also registers model metadata and key mappings, expands partnership content and embeds, updates homepage branding, and introduces an animated 404 page. ChangesOrcaRouter integration
Partnership and site experience
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant Provider as createProvider
participant Service as OrcaRouterService
participant Gateway as OrcaRouter gateway
CLI->>Provider: Select orcarouter
Provider->>Service: Create service and send messages
Service->>Gateway: Stream chat request
Gateway-->>Service: Return text, tool steps, usage, and finish reason
Service-->>CLI: Return content and metadata
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
apps/supercode-cli/server/src/cli/ai/orcarouter-service.ts (2)
45-48: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winFixed 120s timeout may be too tight for multi-step tool sessions.
stopWhen: stepCountIs(8)allows up to 8 LLM/tool round-trips (file reads,run_command,web_search, etc.), but the whole call is bounded by a single hardcoded 120sstreamTimeout. A legitimate multi-step tool session can easily exceed 120s, causing premature abort and a failed/truncated response rather than a graceful completion.Consider scaling the timeout with tool usage (e.g., reset/extend on each
onStepFinish) or making it configurable.Also applies to: 257-259
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/supercode-cli/server/src/cli/ai/orcarouter-service.ts` around lines 45 - 48, Update the stream timeout handling around streamAbortController and streamTimeout so legitimate multi-step sessions are not prematurely aborted by a fixed 120-second limit. Make the timeout configurable or extend/reset it after each completed tool/LLM step, integrating the adjustment with the existing onStepFinish flow while preserving the caller’s abort signal behavior.
57-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSignificant duplication between the no-tools and tools branches.
Both branches independently duplicate the
recordUsage/computeCostcall and the{ content, finishReason, usage }return shape. Consider extracting a sharedfinalize(result)helper to reduce duplication and the risk of the two paths drifting apart on future changes (e.g., themaxTokensfix above would need to be applied twice).Also applies to: 95-241
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/supercode-cli/server/src/cli/ai/orcarouter-service.ts` around lines 57 - 93, Extract the shared usage recording and response construction from the no-tools and tools branches into a local finalize helper near the main streaming logic. Have finalize await the result’s finishReason and usage, call recordUsage with computeCost using the existing model and token fields, and return the common { content, finishReason, usage } shape; update both branches to use it while preserving their distinct streaming behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts`:
- Around line 173-185: The OrcaRouter model costs in the model list already
include the “x” suffix, while the consumer formats them with another suffix.
Update the cost handling between the model entries and the consumer in
connect.ts so each displayed hint contains exactly one “x”, preserving the
existing numeric cost values and model selection behavior.
- Around line 182-183: Update the DeepSeek entries in the model list near the
existing OrcaRouter definitions to use the current DeepSeek model IDs instead of
the deprecated aliases, and revise their labels, costs, and
descriptions/provider metadata to match the current model offerings. Preserve
the existing entry structure and OrcaRouter grouping.
In `@apps/supercode-cli/server/src/config/orcarouter.config.ts`:
- Around line 1-6: Update both occurrences of the hardcoded maxOutputTokens
value in the orcarouter service to use orcarouterConfig.maxTokens, so
ORCAROUTER_MAX_TOKENS and its default are honored consistently.
In `@apps/supercode-cli/server/src/lib/pricing.ts`:
- Around line 32-37: Add a pricing entry in the pricing map for OrcaRouter’s
default model, openai/gpt-4o-mini, using the same pricing values as its upstream
model. Ensure requests resolved through providerMeta.orcarouter.defaultModel or
orcarouterConfig.model receive nonzero cost calculation instead of falling back
to the orcarouter/auto zero-cost entry.
---
Nitpick comments:
In `@apps/supercode-cli/server/src/cli/ai/orcarouter-service.ts`:
- Around line 45-48: Update the stream timeout handling around
streamAbortController and streamTimeout so legitimate multi-step sessions are
not prematurely aborted by a fixed 120-second limit. Make the timeout
configurable or extend/reset it after each completed tool/LLM step, integrating
the adjustment with the existing onStepFinish flow while preserving the caller’s
abort signal behavior.
- Around line 57-93: Extract the shared usage recording and response
construction from the no-tools and tools branches into a local finalize helper
near the main streaming logic. Have finalize await the result’s finishReason and
usage, call recordUsage with computeCost using the existing model and token
fields, and return the common { content, finishReason, usage } shape; update
both branches to use it while preserving their distinct streaming behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 68e191dc-12e2-4e64-bad4-7b0a1d5b4023
📒 Files selected for processing (9)
apps/supercode-cli/server/package.jsonapps/supercode-cli/server/src/cli/ai/context-windows.tsapps/supercode-cli/server/src/cli/ai/orcarouter-service.tsapps/supercode-cli/server/src/cli/ai/provider.tsapps/supercode-cli/server/src/cli/commands/slashCommands/connect.tsapps/supercode-cli/server/src/cli/commands/slashCommands/model.tsapps/supercode-cli/server/src/config/orcarouter.config.tsapps/supercode-cli/server/src/lib/cli-config.tsapps/supercode-cli/server/src/lib/pricing.ts
| { value: "openai/gpt-4o-mini", label: "GPT-4o Mini", provider: "orcarouter", cost: "0.5x", desc: "Cheap & fast" }, | ||
| { value: "openai/gpt-4o", label: "GPT-4o", provider: "orcarouter", cost: "4x", desc: "OpenAI flagship" }, | ||
| { value: "openai/gpt-4.1", label: "GPT-4.1", provider: "orcarouter", cost: "3x", desc: "Latest GPT" }, | ||
| { value: "openai/o3-mini", label: "o3-mini", provider: "orcarouter", cost: "3x", desc: "Reasoning mini" }, | ||
| { value: "openai/o4-mini", label: "o4-mini", provider: "orcarouter", cost: "3x", desc: "Reasoning v4 mini" }, | ||
| { value: "anthropic/claude-sonnet-4.6", label: "Claude Sonnet 4.6", provider: "orcarouter", cost: "12x", desc: "Latest sonnet" }, | ||
| { value: "anthropic/claude-opus-4.7", label: "Claude Opus 4.7", provider: "orcarouter", cost: "40x", desc: "Deep reasoning" }, | ||
| { value: "google/gemini-2.5-flash", label: "Gemini 2.5 Flash", provider: "orcarouter", cost: "2x", desc: "Smart & fast" }, | ||
| { value: "google/gemini-2.5-pro", label: "Gemini 2.5 Pro", provider: "orcarouter", cost: "4x", desc: "Deep reasoning" }, | ||
| { value: "deepseek/deepseek-chat", label: "DeepSeek Chat", provider: "orcarouter", cost: "0.5x", desc: "Via OrcaRouter" }, | ||
| { value: "deepseek/deepseek-reasoner", label: "DeepSeek Reasoner", provider: "orcarouter", cost: "1.5x", desc: "Reasoning model" }, | ||
| { value: "grok/grok-4-fast-reasoning", label: "Grok 4 Fast", provider: "orcarouter", cost: "5x", desc: "Fast reasoning" }, | ||
| { value: "orcarouter/auto", label: "OrcaRouter Auto", provider: "orcarouter", cost: "0x", desc: "Auto-pick cheapest" }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Avoid double-appending the cost suffix.
These entries store values such as "0.5x" and "4x", but connect.ts formats hints as ${m.cost}x, producing "0.5xx" and "4xx" for OrcaRouter models. Normalize the cost representation or stop appending the suffix in the consumer.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts` around
lines 173 - 185, The OrcaRouter model costs in the model list already include
the “x” suffix, while the consumer formats them with another suffix. Update the
cost handling between the model entries and the consumer in connect.ts so each
displayed hint contains exactly one “x”, preserving the existing numeric cost
values and model selection behavior.
| { value: "deepseek/deepseek-chat", label: "DeepSeek Chat", provider: "orcarouter", cost: "0.5x", desc: "Via OrcaRouter" }, | ||
| { value: "deepseek/deepseek-reasoner", label: "DeepSeek Reasoner", provider: "orcarouter", cost: "1.5x", desc: "Reasoning model" }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the surrounding code in the target file
file="apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts"
wc -l "$file"
sed -n '150,210p' "$file"
# Find other DeepSeek references in the repo
rg -n 'deepseek/(deepseek-chat|deepseek-reasoner)|DeepSeek' apps/supercode-cli/server/src/cli/commands/slashCommands -SRepository: yashdev9274/supercli
Length of output: 7507
🌐 Web query:
OrcaRouter DeepSeek legacy aliases deepseek/deepseek-chat deepseek/deepseek-reasoner deprecation July 24 2026 current model IDs
💡 Result:
DeepSeek has scheduled the permanent deprecation of its legacy API model aliases, deepseek/deepseek-chat and deepseek/deepseek-reasoner, for July 24, 2026, at 15:59 UTC [1][2][3]. After this deadline, requests using these legacy identifiers will no longer be accepted by the API and will result in errors [1][2][3]. Migration and Replacement To maintain service, users must update their routing configurations, provider presets, and SDK calls to use the current official DeepSeek V4 model identifiers [1][4][2]. The legacy aliases currently map to the V4-Flash engine [5][2][3], but this backward compatibility ends on July 24 [1][3]. The recommended replacements are [4][3]: 1. deepseek-v4-flash: For general production use. This replaces deepseek-chat [4][3]. 2. deepseek-v4-flash (with reasoning): To replicate the behavior of the deprecated deepseek-reasoner, use deepseek-v4-flash and include the parameter "thinking": {"type": "enabled"} in your request body [4][3]. 3. deepseek-v4-pro: A flagship option for complex reasoning tasks and high-capability workloads, which also supports a 1M context window [4][6]. Action Required Operators of AI gateways (such as OrcaRouter) and applications should perform an immediate audit of all codebase references, environment variables, and infrastructure-as-code configurations to replace these strings [1][2][3]. No grace period is expected; requests failing to migrate before the specified cutoff will cease to function [1][2][3].
Citations:
- 1: https://therouter.ai/news/deepseek-chat-reasoner-july24-cutoff-routing-audit/
- 2: https://therouter.ai/news/deepseek-chat-reasoner-deprecation-v4-migration-routing/
- 3: https://www.developersdigest.tech/blog/deepseek-chat-to-v4-migration-guide
- 4: https://therouter.ai/news/deepseek-v4-api-migration-deprecation-2026/
- 5: https://api-docs.deepseek.com/updates
- 6: https://deepseekv4.network/models
🌐 Web query:
official DeepSeek docs deprecate deepseek-chat deepseek-reasoner deepseek-v4-flash deepseek-v4-pro July 24 2026
💡 Result:
The legacy DeepSeek API model identifiers deepseek-chat and deepseek-reasoner are officially scheduled to be deprecated and fully retired on July 24, 2026, at 15:59 UTC [1][2][3]. After this deadline, any API requests made using these legacy names will fail [4][5][6]. Official DeepSeek documentation clarifies that the identifiers deepseek-v4-flash and deepseek-v4-pro are not being deprecated [1]. Instead, they are the current, active models that users must migrate to [7][2]. For migration purposes, the legacy aliases map to the following functionality within the new model architecture: - deepseek-chat: Corresponds to the non-thinking mode of deepseek-v4-flash [1][3]. - deepseek-reasoner: Corresponds to the thinking mode of deepseek-v4-flash [1][3]. Users are advised to update their API requests to use deepseek-v4-flash or deepseek-v4-pro, adjusting thinking mode configurations as required via request parameters rather than model name selection [1][6]. The API base URL and authentication methods remain unchanged [2][5][6].
Citations:
- 1: https://api-docs.deepseek.com/quick_start/pricing/
- 2: https://api-docs.deepseek.com/news/news260424
- 3: https://api-docs.deepseek.com/
- 4: https://therouter.ai/news/deepseek-chat-reasoner-july24-cutoff-routing-audit/
- 5: https://bytechat.io/blog/deepseek-api-deadline-v4-migration
- 6: https://rohitraj.tech/en/notes/deepseek-v4-api-migration-guide-2026
- 7: https://api-docs.deepseek.com/updates
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts"
# Show nearby DeepSeek entries across all providers
rg -n 'deepseek-v4-flash|deepseek-v4-pro|deepseek-chat|deepseek-reasoner|deepseek-v3|deepseek-r1' "$file" -S
# Inspect the provider sections around the relevant entries
sed -n '40,110p' "$file"
sed -n '140,190p' "$file"Repository: yashdev9274/supercli
Length of output: 13937
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find where the selected model value is consumed
rg -n 'currentModel|stored\?\.model|modelPicker|MODELS|provider: "orcarouter"|provider === "orcarouter"|model:' apps/supercode-cli/server/src/cli/commands/slashCommands -S
# Inspect the selection/request path around the model value
sed -n '440,560p' apps/supercode-cli/server/src/cli/commands/slashCommands/model.tsRepository: yashdev9274/supercli
Length of output: 8641
Replace the deprecated DeepSeek aliases in OrcaRouter
apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts:182-183 still uses deepseek/deepseek-chat and deepseek/deepseek-reasoner; those legacy IDs stop working after July 24, 2026. Swap them to the current DeepSeek IDs and update the cost/metadata to match.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts` around
lines 182 - 183, Update the DeepSeek entries in the model list near the existing
OrcaRouter definitions to use the current DeepSeek model IDs instead of the
deprecated aliases, and revise their labels, costs, and descriptions/provider
metadata to match the current model offerings. Preserve the existing entry
structure and OrcaRouter grouping.
| export const orcarouterConfig = { | ||
| get apiKey() { return process.env.ORCAROUTER_API_KEY || "" }, | ||
| get model() { return process.env.ORCAROUTER_MODEL || "openai/gpt-4o-mini" }, | ||
| baseUrl: "https://api.orcarouter.ai/v1", | ||
| get maxTokens() { return Number(process.env.ORCAROUTER_MAX_TOKENS) || 128000 }, | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
maxTokens is defined but never consumed.
orcarouterConfig.maxTokens reads ORCAROUTER_MAX_TOKENS (default 128000), but orcarouter-service.ts never references it — it hardcodes maxOutputTokens: 8192 instead. Setting ORCAROUTER_MAX_TOKENS has no effect, which is misleading for anyone configuring it.
🔧 Proposed fix
- ...(!HIGH_VALUE_MODELS.includes(this.modelName) ? { maxOutputTokens: 8192 } : {}),
+ ...(!HIGH_VALUE_MODELS.includes(this.modelName) ? { maxOutputTokens: orcarouterConfig.maxTokens } : {}),(apply to both occurrences in orcarouter-service.ts)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/supercode-cli/server/src/config/orcarouter.config.ts` around lines 1 -
6, Update both occurrences of the hardcoded maxOutputTokens value in the
orcarouter service to use orcarouterConfig.maxTokens, so ORCAROUTER_MAX_TOKENS
and its default are honored consistently.
| "anthropic/claude-sonnet-4.6": { inputPrice: 3.00, outputPrice: 15.00, cachedPrice: 0.30 }, | ||
| "anthropic/claude-opus-4.7": { inputPrice: 5.00, outputPrice: 25.00, cachedPrice: 0.50 }, | ||
| "deepseek/deepseek-chat": { inputPrice: 0.15, outputPrice: 0.60, cachedPrice: 0 }, | ||
| "deepseek/deepseek-reasoner": { inputPrice: 0.50, outputPrice: 2.00, cachedPrice: 0 }, | ||
| "grok/grok-4-fast-reasoning": { inputPrice: 1.00, outputPrice: 5.00, cachedPrice: 0 }, | ||
| "orcarouter/auto": { inputPrice: 0, outputPrice: 0, cachedPrice: 0 }, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n '"openai/gpt-4o-mini"|gpt-4o-mini' apps/supercode-cli/server/src/lib/pricing.ts apps/supercode-cli/server/src/cli/ai/context-windows.tsRepository: yashdev9274/supercli
Length of output: 158
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== pricing.ts outline ==\n'
ast-grep outline apps/supercode-cli/server/src/lib/pricing.ts --view expanded || true
printf '\n== provider.ts outline ==\n'
ast-grep outline apps/supercode-cli/server/src/lib/provider.ts --view expanded || true
printf '\n== pricing.ts relevant lines ==\n'
cat -n apps/supercode-cli/server/src/lib/pricing.ts | sed -n '1,220p'
printf '\n== provider.ts relevant lines ==\n'
cat -n apps/supercode-cli/server/src/lib/provider.ts | sed -n '1,260p'Repository: yashdev9274/supercli
Length of output: 5766
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== pricing.ts outline ==\n'
ast-grep outline apps/supercode-cli/server/src/lib/pricing.ts --view expanded || true
printf '\n== provider.ts outline ==\n'
ast-grep outline apps/supercode-cli/server/src/lib/provider.ts --view expanded || true
printf '\n== pricing.ts relevant lines ==\n'
cat -n apps/supercode-cli/server/src/lib/pricing.ts | sed -n '1,220p'
printf '\n== provider.ts relevant lines ==\n'
cat -n apps/supercode-cli/server/src/lib/provider.ts | sed -n '1,260p'Repository: yashdev9274/supercli
Length of output: 5766
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cat -n apps/supercode-cli/server/src/lib/pricing.ts | sed -n '1,220p'
printf '\n----\n'
cat -n apps/supercode-cli/server/src/lib/provider.ts | sed -n '1,260p'Repository: yashdev9274/supercli
Length of output: 5130
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n 'orcarouter|defaultModel|lookupPricing|computeCost' apps/supercode-cli/server/src/libRepository: yashdev9274/supercli
Length of output: 1044
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== gpt-4o-mini references ==\n'
rg -n 'gpt-4o-mini|openai/gpt-4o-mini' .
printf '\n== OrcaRouter references ==\n'
rg -n 'orcarouter|OrcaRouter|defaultModel|providerMeta' apps/supercode-cli/server/srcRepository: yashdev9274/supercli
Length of output: 10449
Add pricing for OrcaRouter’s default model. orcarouter/auto doesn’t cover providerMeta.orcarouter.defaultModel / orcarouterConfig.model (openai/gpt-4o-mini), so default OrcaRouter requests still get logged with costUsd: 0.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/supercode-cli/server/src/lib/pricing.ts` around lines 32 - 37, Add a
pricing entry in the pricing map for OrcaRouter’s default model,
openai/gpt-4o-mini, using the same pricing values as its upstream model. Ensure
requests resolved through providerMeta.orcarouter.defaultModel or
orcarouterConfig.model receive nonzero cost calculation instead of falling back
to the orcarouter/auto zero-cost entry.
- Replaced outdated models with new entries for Claude Opus and Sonnet series. - Added additional models from Grok, DeepSeek, and Kimi, enhancing the variety of options available. - Removed cost details for clarity and consistency across model entries.
- Bumped supercode-cli version to 0.1.79. - Added react-tweet dependency for displaying tweets. - Introduced a new NotFound page for better user experience on 404 errors. - Updated partnerships section to include new partner details and logos.
Description
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
bun testpassesbun run typecheckpassesbun run lintpasses (if applicable)Checklist:
Summary by CodeRabbit