Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ R2_CLI_SESSIONS_BUCKET_NAME=test-bucket
# ============================================================================
# OpenRouter (primary AI provider) - get from https://openrouter.ai/keys
OPENROUTER_API_KEY=sk-or-v1-your-openrouter-key
# FastRouter (alternative OpenRouter-compatible LLM gateway) - get from https://fastrouter.ai
FASTROUTER_API_KEY=
# Optional: Other AI providers
OPENAI_API_KEY=sk-your-openai-key
MISTRAL_API_KEY=your-mistral-key
Expand Down
1 change: 1 addition & 0 deletions apps/web/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ POSTGRES_URL="postgres://postgres:postgres@localhost:5432/postgres"
POSTGRES_CONNECT_TIMEOUT=10000
POSTGRES_MAX_QUERY_TIME=5000
OPENROUTER_API_KEY=invalid-mock-api-key
FASTROUTER_API_KEY=invalid-mock-api-key
STYTCH_PROJECT_ID=test-fake-project-id
STYTCH_PROJECT_SECRET=test-fake-project-secret
NEXT_PUBLIC_STYTCH_PROJECT_ENV=test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ export function getInferenceProvider(
model: KiloExclusiveModel
): OpenRouterInferenceProviderId | null {
if (model.flags.includes('stealth')) return 'stealth';
if (model.gateway === 'openrouter' || model.gateway === 'vercel') return null;
if (
model.gateway === 'openrouter' ||
model.gateway === 'vercel' ||
model.gateway === 'fastrouter'
) {
return null;
}
return OpenRouterInferenceProviderIdSchema.parse(model.gateway);
}

Expand Down
7 changes: 7 additions & 0 deletions apps/web/src/lib/ai-gateway/providers/provider-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export default {
supportedChatApis: ['chat_completions', 'messages', 'responses'],
transformRequest() {},
},
FASTROUTER: {
id: 'fastrouter',
apiUrl: 'https://go.fastrouter.ai/api/v1',
apiKey: getEnvVariable('FASTROUTER_API_KEY'),
supportedChatApis: ['chat_completions'],
transformRequest() {},
},
ALIBABA: {
id: 'alibaba',
apiUrl: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1',
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/lib/ai-gateway/providers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { FraudDetectionHeaders } from '@/lib/utils';

export type ProviderId =
| 'openrouter'
| 'fastrouter'
| 'alibaba'
| 'seed'
| 'direct-byok'
Expand Down
Loading