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
1 change: 0 additions & 1 deletion ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ Manage shared web env var additions and rotations with `pnpm web:env set <VARIAB
- `MISTRAL_API_KEY` - Mistral API key; used in `apps/web/src/lib/ai-gateway/embeddings/embedding-providers.ts` for `codestral-embed-2505` and `mistral-embed` embeddings, in the FIM completions proxy at `apps/web/src/app/api/fim/completions/route.ts` (routes Mistral Codestral vs. La Plateforme keys), and as a provider config in `apps/web/src/lib/config.server.ts`. `[SECRET]`
- `LONGCAT_API_KEY` - LongCat API key for model inference through the AI gateway; provider definition in `apps/web/src/lib/ai-gateway/providers/definitions/longcat.ts`. `[SECRET]`
- `STREAMLAKE_API_KEY` - StreamLake API key for model inference through the AI gateway; provider definition in `apps/web/src/lib/ai-gateway/providers/definitions/streamlake.ts`. `[SECRET]`
- `PERPLEXITY_API_KEY` - Perplexity API key for percentage-routed Kimi K3 inference through the AI gateway; provider definition in `apps/web/src/lib/ai-gateway/providers/partner/providers.ts`. `[SECRET]`
- `INCEPTION_API_KEY` - Inception Labs API key; used in `apps/web/src/app/api/fim/completions/route.ts` and `apps/web/src/app/api/edit/completions/route.ts` as a fill-in-the-middle (FIM) provider, with endpoint `https://api.inceptionlabs.ai/v1/fim/completions`. Defined in `apps/web/src/lib/config.server.ts`. `[SECRET]`
- `AI_ATTRIBUTION_ADMIN_SECRET` - Admin secret for the AI Attribution service (`apps/web/src/lib/ai-attribution-service.ts`); sent as `X-Admin-Secret` header. `[SECRET]`
- `ARTIFICIAL_ANALYSIS_API_KEY` - API key for Artificial Analysis (`apps/web/src/lib/model-stats/sync-artificial-analysis.ts`); sent as `x-api-key` header for model benchmarking data sync. `[SECRET]`
Expand Down
48 changes: 5 additions & 43 deletions apps/web/src/app/admin/gateway/RoutingContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Textarea } from '@/components/ui/textarea';
import { Label } from '@/components/ui/label';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import {
DEFAULT_PERPLEXITY_PERCENTAGE,
DEFAULT_VERCEL_PERCENTAGE,
DEFAULT_VERCEL_PERCENTAGE_FREE,
NOTE_MAX_LENGTH,
Expand All @@ -25,7 +24,6 @@ export function RoutingContent() {

const [inputValue, setInputValue] = useState('');
const [freeInputValue, setFreeInputValue] = useState('');
const [perplexityInputValue, setPerplexityInputValue] = useState('');
const [optOutModelsValue, setOptOutModelsValue] = useState('');
const [noteValue, setNoteValue] = useState('');
const [hasChanges, setHasChanges] = useState(false);
Expand All @@ -34,7 +32,6 @@ export function RoutingContent() {
if (data) {
setInputValue(data.vercel_routing_percentage?.toString() ?? '');
setFreeInputValue(data.vercel_routing_percentage_free?.toString() ?? '');
setPerplexityInputValue(data.perplexity_routing_percentage?.toString() ?? '');
setOptOutModelsValue(data.vercel_routing_opt_out_models.join('\n'));
setNoteValue(data.note ?? '');
setHasChanges(false);
Expand Down Expand Up @@ -83,8 +80,7 @@ export function RoutingContent() {
const note = noteInput();
const paid = parsePercentage(inputValue);
const free = parsePercentage(freeInputValue);
const perplexity = parsePercentage(perplexityInputValue);
if (paid === undefined || free === undefined || perplexity === undefined) {
if (paid === undefined || free === undefined) {
toast.error(
'Enter a percentage between 0 and 100 with up to 3 decimal places, or leave it empty for the default.'
);
Expand All @@ -94,7 +90,6 @@ export function RoutingContent() {
vercel_routing_percentage: paid,
vercel_routing_percentage_free: free,
vercel_routing_opt_out_models: optOutModels(),
perplexity_routing_percentage: perplexity,
note,
});
}
Expand All @@ -104,7 +99,6 @@ export function RoutingContent() {
vercel_routing_percentage: null,
vercel_routing_percentage_free: null,
vercel_routing_opt_out_models: optOutModels(),
perplexity_routing_percentage: null,
note: noteInput(),
});
}
Expand All @@ -115,11 +109,9 @@ export function RoutingContent() {

const currentOverride = data?.vercel_routing_percentage;
const currentFreeOverride = data?.vercel_routing_percentage_free;
const currentPerplexityOverride = data?.perplexity_routing_percentage;
const isOverrideActive =
(currentOverride !== null && currentOverride !== undefined) ||
(currentFreeOverride !== null && currentFreeOverride !== undefined) ||
(currentPerplexityOverride !== null && currentPerplexityOverride !== undefined);
(currentFreeOverride !== null && currentFreeOverride !== undefined);

return (
<div className="flex w-full flex-col gap-y-6">
Expand All @@ -131,8 +123,7 @@ export function RoutingContent() {
to Vercel (vs OpenRouter). Models not available on Vercel always go to OpenRouter, so
overall traffic may still be skewed towards OpenRouter. Paid and free models are
configured separately. Leave empty to use the default ({DEFAULT_VERCEL_PERCENTAGE}% for
paid, {DEFAULT_VERCEL_PERCENTAGE_FREE}% for free). Perplexity routes only its configured
models and defaults to {DEFAULT_PERPLEXITY_PERCENTAGE}%.
paid, {DEFAULT_VERCEL_PERCENTAGE_FREE}% for free).
</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-4">
Expand Down Expand Up @@ -183,30 +174,6 @@ export function RoutingContent() {
/>
<span className="text-muted-foreground text-sm">%</span>
</div>
<p className="pt-2 text-sm font-medium">Direct partners</p>
<div className="flex items-center gap-3">
<Label htmlFor="routing-perplexity" className="w-24 shrink-0">
Perplexity
</Label>
<Input
id="routing-perplexity"
type="number"
min={0}
max={100}
step={0.001}
placeholder={`Default: ${DEFAULT_PERPLEXITY_PERCENTAGE}%`}
value={perplexityInputValue}
onChange={e => {
setPerplexityInputValue(e.target.value);
setHasChanges(true);
}}
onKeyDown={e => {
if (e.key === 'Enter') handleSave();
}}
className="w-48"
/>
<span className="text-muted-foreground text-sm">%</span>
</div>
<div className="flex flex-col gap-2">
<Label htmlFor="routing-opt-out-models">Opt-out models</Label>
<Textarea
Expand Down Expand Up @@ -269,11 +236,7 @@ export function RoutingContent() {
<span className="text-foreground font-medium">
{currentFreeOverride ?? DEFAULT_VERCEL_PERCENTAGE_FREE}%
</span>{' '}
of free traffic goes to Vercel. Perplexity receives{' '}
<span className="text-foreground font-medium">
{currentPerplexityOverride ?? DEFAULT_PERPLEXITY_PERCENTAGE}%
</span>{' '}
of eligible Kimi K3 traffic.
of free traffic goes to Vercel.
{data?.updated_by_email && (
<span className="ml-1">
Set by {data.updated_by_email}
Expand All @@ -284,8 +247,7 @@ export function RoutingContent() {
) : (
<p>
No override set. Using default routing ({DEFAULT_VERCEL_PERCENTAGE}% of paid and{' '}
{DEFAULT_VERCEL_PERCENTAGE_FREE}% of free traffic to Vercel and{' '}
{DEFAULT_PERPLEXITY_PERCENTAGE}% to Perplexity).
{DEFAULT_VERCEL_PERCENTAGE_FREE}% of free traffic to Vercel).
</p>
)}
{data?.note && (
Expand Down
Loading
Loading