Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
68be55a
feat: Add AIStupidLevel provider integration
StudioPlatforms Oct 17, 2025
b278d7e
fix: Resolve merge conflict - add local providers from main
StudioPlatforms Oct 17, 2025
67c3ee2
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 17, 2025
5c000f9
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 18, 2025
ee12f40
feat: Complete AIStupidLevel provider implementation
StudioPlatforms Oct 18, 2025
8d180a5
fix: Add kilocode_change markers and comprehensive tests
StudioPlatforms Oct 19, 2025
766c9e3
fix: Address maintainer code review feedback
StudioPlatforms Oct 19, 2025
27bb593
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 20, 2025
c564cb7
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 20, 2025
9c9c866
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 21, 2025
088a53f
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 21, 2025
9634b9e
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 21, 2025
c6770e0
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 22, 2025
27f35d4
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 22, 2025
362e9a2
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 22, 2025
a08fff2
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 22, 2025
ea16b63
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 22, 2025
3b207cb
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 23, 2025
ae60dd7
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 23, 2025
2719bc5
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 23, 2025
d2d3e21
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 24, 2025
d1ba78e
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 26, 2025
7fd4a04
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 28, 2025
ce1b555
Merge branch 'main' into add-aistupidlevel-provider
StudioPlatforms Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions apps/kilocode-docs/docs/providers/aistupidlevel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
sidebar_label: AIStupidLevel
---

# Using AIStupidLevel With Kilo Code

AIStupidLevel is an intelligent AI router that continuously benchmarks 25+ AI models across multiple providers and automatically routes your requests to the best-performing model based on real-time performance data.

**Website:** [https://aistupidlevel.info](https://aistupidlevel.info)

## What is AIStupidLevel?

AIStupidLevel is a smart AI router that automatically selects the best-performing model for your requests based on continuous benchmarking. Learn more at [aistupidlevel.info](https://aistupidlevel.info).

## Getting an API Key

1. **Sign Up:** Go to [https://aistupidlevel.info](https://aistupidlevel.info) and create an account
2. **Navigate to Router:** Click on the "Router" section in the dashboard
3. **Add Provider Keys:** Add your API keys for the providers you want to use (OpenAI, Anthropic, Google, xAI, etc.)
4. **Generate Router Key:** Create a router API key that Kilo Code will use
5. **Copy the Key:** Copy your AIStupidLevel router API key

## Available Routing Strategies

AIStupidLevel offers different "auto" models that optimize for specific use cases:

| Model | Description | Best For |
|-------|-------------|----------|
| `auto` | Best overall performance across all metrics | General-purpose tasks |
| `auto-coding` | Optimized for code generation and quality | Software development, debugging |
| `auto-reasoning` | Best for complex reasoning and problem-solving | Deep analysis, mathematical problems |
| `auto-creative` | Optimized for creative writing quality | Content creation, storytelling |
| `auto-cheapest` | Most cost-effective option | High-volume, budget-conscious tasks |
| `auto-fastest` | Fastest response time | Real-time applications, quick queries |

## Configuration in Kilo Code

**Important:** Before using AIStupidLevel, you must add your own provider API keys (OpenAI, Anthropic, etc.) to your [AIStupidLevel dashboard](https://aistupidlevel.info/router). The router uses your keys to access the underlying models.

1. **Open Kilo Code Settings:** Click the gear icon (<Codicon name="gear" />) in the Kilo Code panel.
2. **Select Provider:** Choose "AIStupidLevel" from the "API Provider" dropdown.
3. **Enter API Key:** Paste your AIStupidLevel router API key into the "AIStupidLevel API Key" field.
4. **Select Model:** Choose your desired routing strategy from the "Model" dropdown (e.g., `auto-coding`, `auto-reasoning`, etc.).

## How It Works

When you make a request through Kilo Code:

1. **AIStupidLevel analyzes** current model performance from continuous benchmarks
2. **Selects the optimal model** based on your chosen routing strategy
3. **Routes your request** using your configured provider API keys
4. **Returns the response** with metadata about which model was selected

The router automatically:
- Avoids models experiencing performance degradation
- Routes to cheaper models when performance is comparable
- Provides transparent routing decisions in response headers

## Key Features

For detailed information about AIStupidLevel's features, benchmarking methodology, and performance tracking, visit [aistupidlevel.info](https://aistupidlevel.info).

## Response Headers

AIStupidLevel includes custom headers in responses to show routing decisions:

```
X-AISM-Provider: anthropic
X-AISM-Model: claude-sonnet-4-20250514
X-AISM-Reasoning: Selected claude-sonnet-4-20250514 from anthropic for best coding capabilities (score: 42.3). Ranked #1 of 12 available models. Last updated 2h ago.
```

## Pricing

AIStupidLevel charges only for the underlying model usage (at cost) plus a small routing fee. You can monitor costs in real-time through the dashboard at [https://aistupidlevel.info/router](https://aistupidlevel.info/router).

## Tips and Notes

- **Model Selection:** The router automatically selects the best model based on real-time benchmarks - you don't need to manually switch models
- **Performance Monitoring:** Check the [AIStupidLevel dashboard](https://aistupidlevel.info) to see live performance rankings and routing decisions
- **Cost Tracking:** The dashboard shows your cost savings compared to always using premium models

## Learn More

- **Website:** [https://aistupidlevel.info](https://aistupidlevel.info)
- **Router Dashboard:** [https://aistupidlevel.info/router](https://aistupidlevel.info/router)
- **Live Benchmarks:** [https://aistupidlevel.info](https://aistupidlevel.info)
- **Community:** [r/AIStupidLevel](https://www.reddit.com/r/AIStupidlevel)
- **Twitter/X:** [@AIStupidlevel](https://x.com/AIStupidlevel)
11 changes: 11 additions & 0 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const dynamicProviders = [
"requesty",
"unbound",
"glama",
"aistupidlevel",
] as const

export type DynamicProvider = (typeof dynamicProviders)[number]
Expand Down Expand Up @@ -490,6 +491,11 @@ const vercelAiGatewaySchema = baseProviderSettingsSchema.extend({
vercelAiGatewayModelId: z.string().optional(),
})

const aiStupidLevelSchema = baseProviderSettingsSchema.extend({
aiStupidLevelApiKey: z.string().optional(),
aiStupidLevelModelId: z.string().optional(),
})

const defaultSchema = z.object({
apiProvider: z.undefined(),
})
Expand Down Expand Up @@ -537,6 +543,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
qwenCodeSchema.merge(z.object({ apiProvider: z.literal("qwen-code") })),
rooSchema.merge(z.object({ apiProvider: z.literal("roo") })),
vercelAiGatewaySchema.merge(z.object({ apiProvider: z.literal("vercel-ai-gateway") })),
aiStupidLevelSchema.merge(z.object({ apiProvider: z.literal("aistupidlevel") })),
defaultSchema,
])

Expand Down Expand Up @@ -583,6 +590,7 @@ export const providerSettingsSchema = z.object({
...qwenCodeSchema.shape,
...rooSchema.shape,
...vercelAiGatewaySchema.shape,
...aiStupidLevelSchema.shape,
...codebaseIndexProviderSchema.shape,
...ovhcloudSchema.shape, // kilocode_change
})
Expand Down Expand Up @@ -620,6 +628,7 @@ export const modelIdKeys = [
"deepInfraModelId",
"kilocodeModel",
"ovhCloudAiEndpointsModelId", // kilocode_change
"aiStupidLevelModelId",
] as const satisfies readonly (keyof ProviderSettings)[]

export type ModelIdKey = (typeof modelIdKeys)[number]
Expand Down Expand Up @@ -676,6 +685,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
kilocode: "kilocodeModel",
"virtual-quota-fallback": "apiModelId",
ovhcloud: "ovhCloudAiEndpointsModelId", // kilocode_change
aistupidlevel: "aiStupidLevelModelId",
}

/**
Expand Down Expand Up @@ -816,6 +826,7 @@ export const MODELS_BY_PROVIDER: Record<
// kilocode_change end
deepinfra: { id: "deepinfra", label: "DeepInfra", models: [] },
"vercel-ai-gateway": { id: "vercel-ai-gateway", label: "Vercel AI Gateway", models: [] },
aistupidlevel: { id: "aistupidlevel", label: "AIStupidLevel", models: [] },

// Local providers; models discovered from localhost endpoints.
lmstudio: { id: "lmstudio", label: "LM Studio", models: [] },
Expand Down
27 changes: 27 additions & 0 deletions packages/types/src/providers/aistupidlevel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { ModelInfo } from "../model.js"

export const aiStupidLevelDefaultModelId = "auto-coding"

export const aiStupidLevelDefaultModelInfo: ModelInfo = {
maxTokens: 8192,
contextWindow: 200000,
supportsImages: true,
supportsComputerUse: false,
supportsPromptCache: false,
// Pricing varies by underlying model selected, these are approximate averages
inputPrice: 0.5, // ~$0.50 per million input tokens (average across routed models)
outputPrice: 1.5, // ~$1.50 per million output tokens (average across routed models)
description: "Optimized for code generation and quality",
}

export const AISTUPIDLEVEL_DEFAULT_TEMPERATURE = 0.7

// Default fallback models when API fetch fails
export const aiStupidLevelFallbackModels = [
"auto",
"auto-coding",
"auto-reasoning",
"auto-creative",
"auto-cheapest",
"auto-fastest",
]
1 change: 1 addition & 0 deletions packages/types/src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ export * from "./xai.js"
export * from "./vercel-ai-gateway.js"
export * from "./zai.js"
export * from "./deepinfra.js"
export * from "./aistupidlevel.js" // kilocode_change
5 changes: 5 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
VercelAiGatewayHandler,
DeepInfraHandler,
OVHcloudAIEndpointsHandler, // kilocode_change
AIStupidLevelHandler, // kilocode_change
} from "./providers"
// kilocode_change start
import { KilocodeOpenrouterHandler } from "./providers/kilocode-openrouter"
Expand Down Expand Up @@ -206,6 +207,10 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
case "ovhcloud":
return new OVHcloudAIEndpointsHandler(options)
// kilocode_change end
// kilocode_change start
case "aistupidlevel":
return new AIStupidLevelHandler(options)
// kilocode_change end
default:
apiProvider satisfies "gemini-cli" | undefined
return new AnthropicHandler(options)
Expand Down
Loading