-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Add AIStupidLevel provider integration #3101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add AIStupidLevel provider integration #3101
Conversation
- Added AIStupidLevel as a dynamic provider in provider-settings.ts - Created schema and configuration for AIStupidLevel - Added AIStupidLevel to MODELS_BY_PROVIDER and modelIdKeysByProvider - Updated api.ts to include AIStupidLevel in dynamicProviderExtras - Created comprehensive documentation for AIStupidLevel provider AIStupidLevel is an intelligent AI router that automatically selects the best-performing model based on real-time benchmarks across 25+ AI models from multiple providers (OpenAI, Anthropic, Google, xAI, etc.). Features: - 6 routing strategies (auto, auto-coding, auto-reasoning, auto-creative, auto-cheapest, auto-fastest) - Real-time performance benchmarking with 7-axis scoring - Statistical degradation detection - Cost optimization with automatic provider switching - Transparent routing decisions
|
- Added lmstudio and ollama to MODELS_BY_PROVIDER - Maintains aistupidlevel provider integration - Resolves conflict with main branch changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request appears to be incomplete?
There's docs and a couple added settings, but no UI to configure, no tests, no provider implementation, etc.
This commit completes the AIStupidLevel provider integration with all required components: Backend Implementation: - Add AIStupidLevelHandler extending RouterProvider - Implement model fetcher with fallback to default routing strategies - Integrate into buildApiHandler and model cache system - Support for streaming and single completion modes Type Definitions: - Add provider settings schema and validation - Define default model constants (auto-coding as default) - Export types from providers index UI Components: - Create AIStupidLevel settings component with API key input - Add model picker for routing strategy selection - Integrate into ApiOptions with proper routing - Add to provider constants list Translations: - Add English translation keys for API key labels Features: - Smart routing with multiple strategies (auto, auto-coding, auto-reasoning, etc.) - OpenAI-compatible API integration - Fallback models when API fetch fails - Full streaming support - Proper error handling This addresses the maintainer feedback about the incomplete PR by providing: ✓ Complete provider implementation ✓ UI configuration components ✓ Proper integration throughout codebase ✓ Type-safe implementation
Hi @mcowger, Sorry about the incomplete initial submission! I've now pushed a complete implementation that addresses all your feedback: What's Been Added:✅ Complete Provider Implementation
✅ Model Fetcher
✅ UI Configuration
✅ Type Definitions
✅ Translations
The implementation now follows the same patterns as other providers in the codebase (like VercelAiGateway, DeepInfra, etc.) and should be ready for review. Let me know if you need any changes! Thanks for your patience! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is overall a really solid first PR. Nicely done.
A couple overall things beyond the small comments made on specific lines:
-
Need to add //kilocode_change markers for changes to existing files (net new files dont need them). These are used to make merging from Roo/Cline easier.
a. Block markers: "// kilocode_change start" ... "// kilocode_change end" — used to mark a region of added/modified code.
b. Inline markers: "// kilocode_change", or comment suffixes like "// kilocode_change: explanation" — used to flag single-line changes or explain why a change was made. -
There are no tests provided. See some examples in the PR for Synthetic: https://github.com/Kilo-Org/kilocode/pull/2567/files
- **Provider Diversity:** Access models from OpenAI, Anthropic, Google, xAI, DeepSeek, and more through one API | ||
- **Transparent Routing:** Response headers show which model was selected and why | ||
- **Performance Tracking:** Dashboard shows your usage, cost savings, and routing decisions | ||
- **Enterprise SLA:** 99.9% uptime guarantee with multi-region deployment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than including the marketing copy here, could you include a link to your own pages?
|
||
## Tips and Notes | ||
|
||
- **Provider Keys Required:** You must add your own provider API keys (OpenAI, Anthropic, etc.) to your AIStupidLevel dashboard before using the router |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go into the 'Configuration' section above given that its a required activity.
supportsImages: true, | ||
supportsComputerUse: false, | ||
supportsPromptCache: false, | ||
inputPrice: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set correct default prices here?
* getAIStupidLevelModels | ||
*/ | ||
|
||
export async function getAIStupidLevelModels(apiKey?: string): Promise<Record<string, ModelInfo>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is required to get anything useful, this should be a required parameter
const baseURL = "https://api.aistupidlevel.info/v1" | ||
|
||
// Define the standard routing strategies as fallback | ||
const defaultModels = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded fallbacks should go in the packages/types/src/providers/aistupidlevel.ts
* parseAIStupidLevelModel | ||
*/ | ||
|
||
export const parseAIStupidLevelModel = (model: AIStupidLevelModel): ModelInfo => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good type safety!
}) | ||
} | ||
|
||
override async *createMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no non-streaming path implemented here. But your implementation of completePrompt() below certainly implies your service supports it.
Is it intentional to only support streaming for agentic activity?
src/api/providers/aistupidlevel.ts
Outdated
type: "usage", | ||
inputTokens: chunk.usage.prompt_tokens || 0, | ||
outputTokens: chunk.usage.completion_tokens || 0, | ||
totalCost: 0, // AIStupidLevel handles cost tracking in their dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If total cost information isn't available in the response, we should not override it to zero. Can you use undefined, or null, or exclude it from the response?
Addresses maintainer feedback: 1. Added // kilocode_change markers to all modified files: - src/api/index.ts - src/api/providers/index.ts - src/api/providers/fetchers/modelCache.ts - packages/types/src/providers/index.ts - webview-ui/src/components/settings/providers/index.ts - webview-ui/src/components/settings/constants.ts - webview-ui/src/i18n/locales/en/settings.json 2. Added comprehensive test suite: - src/api/providers/__tests__/aistupidlevel.spec.ts - Tests provider initialization and configuration - Tests API key validation - Tests model selection and routing strategies - Tests streaming and single completion modes - Tests error handling - Tests all routing strategy models (auto, auto-coding, auto-reasoning, etc.) - Follows same pattern as synthetic.spec.ts All changes now properly marked for easier merging from Roo/Cline.
Addresses all inline code review comments: 1. Documentation (apps/kilocode-docs/docs/providers/aistupidlevel.md): - Removed marketing copy, replaced with link to aistupidlevel.info - Moved 'Provider Keys Required' note to Configuration section - Simplified Key Features section with link to website 2. Pricing (packages/types/src/providers/aistupidlevel.ts): - Set realistic default prices: $0.50 input, $1.50 output per million tokens - Added comment explaining prices are approximate averages - Added aiStupidLevelFallbackModels array for default models 3. API Key (src/api/providers/fetchers/aistupidlevel.ts): - Made apiKey a required parameter (removed optional) - Moved hardcoded fallback models to types file - Now uses aiStupidLevelFallbackModels from @roo-code/types - Updated default pricing fallbacks to match types 4. Cost Tracking (src/api/providers/aistupidlevel.ts): - Removed totalCost: 0 override - Added comment explaining cost calculation is handled by pricing - Allows proper cost calculation from inputPrice/outputPrice
Hi @mcowger, Thank you for the detailed code review! I've addressed all your feedback: Changes Made:1. Documentation (apps/kilocode-docs/docs/providers/aistupidlevel.md)
2. Pricing (packages/types/src/providers/aistupidlevel.ts)
3. API Key (src/api/providers/fetchers/aistupidlevel.ts)
4. Cost Tracking (src/api/providers/aistupidlevel.ts)
5. Tests & Markers (from previous feedback)
All conversations should now be ready to resolve. Please let me know if there's anything else that needs adjustment! Latest commits: |
Solid! This is a nice PR! Looking forward to seeing it merged. |
Summary
This PR adds AIStupidLevel as a new provider to Kilo Code, enabling users to leverage an intelligent AI router that automatically selects the best-performing model based on real-time benchmarks.
What is AIStupidLevel?
AIStupidLevel is an intelligent AI router that continuously benchmarks 25+ AI models across multiple providers (OpenAI, Anthropic, Google, xAI, DeepSeek, and more) and automatically routes requests to the best-performing model based on real-time performance data.
Changes Made
1. Provider Type Definitions (
packages/types/src/provider-settings.ts
)aistupidlevel
to thedynamicProviders
arrayaiStupidLevelSchema
with API key and model ID configurationaiStupidLevelModelId
tomodelIdKeys
modelIdKeysByProvider
mappingMODELS_BY_PROVIDER
with label "AIStupidLevel"providerSettingsSchema
2. API Handler (
src/shared/api.ts
)dynamicProviderExtras
with optional API key parameter3. Documentation (
apps/kilocode-docs/docs/providers/aistupidlevel.md
)Available Routing Strategies
AIStupidLevel offers 6 intelligent routing strategies:
auto
- Best overall performance across all metricsauto-coding
- Optimized for code generation and qualityauto-reasoning
- Best for complex reasoning and problem-solvingauto-creative
- Optimized for creative writing qualityauto-cheapest
- Most cost-effective optionauto-fastest
- Fastest response timeKey Features
Testing
The integration follows the same pattern as other dynamic providers in Kilo Code (OpenRouter, Vercel AI Gateway, etc.) and should work seamlessly with the existing infrastructure.
Documentation
Full documentation has been added at
apps/kilocode-docs/docs/providers/aistupidlevel.md
following the same format as other provider documentation.Links