From afc1acbb14a8ebb4978aa7b1cca865fe92e3bfaf Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Tue, 18 Aug 2026 16:26:24 +0200 Subject: [PATCH 1/4] feat(ai-gateway): add discounted GPT-5.6 Sol model --- apps/web/src/lib/ai-gateway/models.test.ts | 61 +++++++++++++------ apps/web/src/lib/ai-gateway/models.ts | 10 ++- .../providers/kilo-exclusive-model.ts | 9 +++ .../ai-gateway/providers/openai-exclusive.ts | 38 +++++++++++- .../ai-gateway/providers/vercel/index.test.ts | 11 ++++ .../lib/ai-gateway/providers/vercel/index.ts | 3 + .../tests/openrouter-models-config.test.ts | 10 +-- 7 files changed, 116 insertions(+), 26 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/models.test.ts b/apps/web/src/lib/ai-gateway/models.test.ts index 3224c7a229..7adf6a0312 100644 --- a/apps/web/src/lib/ai-gateway/models.test.ts +++ b/apps/web/src/lib/ai-gateway/models.test.ts @@ -19,7 +19,10 @@ import { claude_opus_4_6_stealth_model, } from './providers/anthropic.constants'; import { deepseek_v4_pro_discounted_model } from './providers/deepseek'; -import { gpt_5_6_sol_stealth_model } from './providers/openai-exclusive'; +import { + gpt_5_6_sol_discounted_model, + gpt_5_6_sol_stealth_model, +} from './providers/openai-exclusive'; import { tencent_hy3_free_model } from './providers/tencent'; import { gemma_4_26b_a4b_it_free_model } from './providers/google'; import { longcat_2_free_model } from './providers/longcat'; @@ -117,33 +120,52 @@ describe('isFreeModel', () => { expect(claude_opus_4_6_stealth_model.public_id).toBe('stealth/claude-opus-4.6'); }); - test('registers GPT-5.6 Sol as a Martian stealth model', () => { - expect(findKiloExclusiveModel('stealth/gpt-5.6-sol')).toBe(gpt_5_6_sol_stealth_model); - expect(gpt_5_6_sol_stealth_model.internal_id).toBe('openai/gpt-5.6-sol:optimized'); - expect(gpt_5_6_sol_stealth_model.gateway).toBe('martian'); - expect(getInferenceProvider(gpt_5_6_sol_stealth_model)?.slug).toBe('stealth'); - expect(gpt_5_6_sol_stealth_model.pricing?.tiers).toEqual([ + test('registers the discounted GPT-5.6 Sol OpenAI endpoint', async () => { + expect(findKiloExclusiveModel(gpt_5_6_sol_discounted_model.public_id)).toBe( + gpt_5_6_sol_discounted_model + ); + expect(gpt_5_6_sol_discounted_model).toMatchObject({ + internal_id: 'openai/gpt-5.6-sol', + gateway: 'vercel', + flags: ['reasoning', 'vision'], + inference_provider_restriction: ['openai'], + }); + expect(getInferenceProvider(gpt_5_6_sol_discounted_model)).toEqual({ + slug: 'openai', + name: 'OPENAI', + training: false, + retainsPrompts: true, + }); + expect( + await hasBestEffortGuessDataCollectionRequirement(gpt_5_6_sol_discounted_model.public_id) + ).toBe(false); + expect(gpt_5_6_sol_discounted_model.pricing?.tiers).toEqual([ { start_context_length: 0, pricing: { - prompt_per_million: 4, - completion_per_million: 24, - input_cache_read_per_million: 0.4, - input_cache_write_per_million: 5, + prompt_per_million: 2.5, + completion_per_million: 15, + input_cache_read_per_million: 0.25, + input_cache_write_per_million: 3.125, }, }, { start_context_length: 272_000, pricing: { - prompt_per_million: 8, - completion_per_million: 36, - input_cache_read_per_million: 0.8, - input_cache_write_per_million: 10, + prompt_per_million: 5, + completion_per_million: 22.5, + input_cache_read_per_million: 0.5, + input_cache_write_per_million: 6.25, }, }, ]); }); + test('keeps the previous GPT-5.6 Sol stealth discount disabled', () => { + expect(gpt_5_6_sol_stealth_model.status).toBe('disabled'); + expect(findKiloExclusiveModel(gpt_5_6_sol_stealth_model.public_id)).toBeNull(); + }); + test('all Kilo exclusive models should have either no pricing or valid ordered pricing tiers', () => { for (const model of kiloExclusiveModels) { if (model.pricing) { @@ -366,15 +388,18 @@ describe('getKiloExclusiveInferenceProviderRestriction', () => { expect( getKiloExclusiveInferenceProviderRestriction(deepseek_v4_pro_discounted_model.public_id) ).toEqual(new Set(['deepseek'])); + expect( + getKiloExclusiveInferenceProviderRestriction(gpt_5_6_sol_discounted_model.public_id) + ).toEqual(new Set(['openai'])); expect(getKiloExclusiveInferenceProviderRestriction(tencent_hy3_free_model.public_id)).toEqual( new Set(['tencent']) ); }); test('does not treat unrestricted exclusives or unknown ids as restricted', () => { - expect( - getKiloExclusiveInferenceProviderRestriction(gpt_5_6_sol_stealth_model.public_id) - ).toBeUndefined(); + expect(getKiloExclusiveInferenceProviderRestriction(gpt_5_6_sol_stealth_model.public_id)).toBe( + undefined + ); expect( getKiloExclusiveInferenceProviderRestriction(gemma_4_26b_a4b_it_free_model.public_id) ).toBeUndefined(); diff --git a/apps/web/src/lib/ai-gateway/models.ts b/apps/web/src/lib/ai-gateway/models.ts index 719e348f2f..3293446afe 100644 --- a/apps/web/src/lib/ai-gateway/models.ts +++ b/apps/web/src/lib/ai-gateway/models.ts @@ -28,7 +28,10 @@ import { longcat_2_free_model } from '@/lib/ai-gateway/providers/longcat'; import { isGrokModel } from '@/lib/ai-gateway/providers/xai'; import { isClaudeModel } from '@/lib/ai-gateway/providers/anthropic.constants'; import { GPT_CURRENT_MODEL_ID, isOpenAiModel } from '@/lib/ai-gateway/providers/openai'; -import { gpt_5_6_sol_stealth_model } from '@/lib/ai-gateway/providers/openai-exclusive'; +import { + gpt_5_6_sol_discounted_model, + gpt_5_6_sol_stealth_model, +} from '@/lib/ai-gateway/providers/openai-exclusive'; import { GLM_CURRENT_MODEL_ID } from '@/lib/ai-gateway/providers/zai'; import { deepseekDiscountedModels } from '@/lib/ai-gateway/providers/deepseek'; import { type ProviderId } from '@/lib/ai-gateway/providers/types'; @@ -89,7 +92,9 @@ export const preferredModels = [ CLAUDE_SONNET_CURRENT_MODEL_ID, CLAUDE_OPUS_CURRENT_MODEL_ID, GPT_CURRENT_MODEL_ID, - ...(gpt_5_6_sol_stealth_model.status === 'public' ? [gpt_5_6_sol_stealth_model.public_id] : []), + ...(gpt_5_6_sol_discounted_model.status === 'public' + ? [gpt_5_6_sol_discounted_model.public_id] + : []), GLM_CURRENT_MODEL_ID, KIMI_CURRENT_MODEL_ID, MINIMAX_CURRENT_MODEL_ID, @@ -126,6 +131,7 @@ export const kiloExclusiveModels = [ ...deepseekDiscountedModels, qwen36_plus_stealth_model, gpt_5_6_sol_stealth_model, + gpt_5_6_sol_discounted_model, claude_opus_4_8_stealth_model, claude_opus_4_7_stealth_model, claude_sonnet_4_6_stealth_model, diff --git a/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts b/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts index ed498298f1..a4354687ad 100644 --- a/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts +++ b/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts @@ -194,6 +194,15 @@ export function getInferenceProvider(model: KiloExclusiveModel): InferenceProvid if (model.flags.includes('stealth')) { return { slug: 'stealth', name: 'Stealth', training: true, retainsPrompts: true }; } + if (model.inference_provider_restriction.length === 1) { + const slug = model.inference_provider_restriction[0]; + return { + slug, + name: slug.toUpperCase(), + training: model.flags.includes('requires-data-collection'), + retainsPrompts: true, + }; + } if (model.gateway === 'openrouter' || model.gateway === 'vercel') { return null; } diff --git a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts index 81b28d6271..0e6195bfa2 100644 --- a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts +++ b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts @@ -6,7 +6,7 @@ export const gpt_5_6_sol_stealth_model: KiloExclusiveModel = { display_name: 'Stealth: GPT-5.6 Sol (20% off)', description: "Your prompts and completions may be retained and used to train or improve the provider's services. This third-party-served variant of GPT-5.6 Sol is offered at 20% lower cost than standard GPT-5.6 Sol pricing and is not served by OpenAI or Kilo Code.", - status: 'public', + status: 'disabled', context_length: 1_050_000, max_completion_tokens: 128_000, gateway: 'martian', @@ -35,3 +35,39 @@ export const gpt_5_6_sol_stealth_model: KiloExclusiveModel = { }, inference_provider_restriction: [], }; + +export const gpt_5_6_sol_discounted_model: KiloExclusiveModel = { + public_id: 'openai/gpt-5.6-sol-discounted', + internal_id: 'openai/gpt-5.6-sol', + display_name: 'OpenAI: GPT-5.6 Sol (50% off)', + description: + 'GPT-5.6 Sol served by OpenAI through Vercel AI Gateway at 50% lower cost than other available inference providers. OpenAI does not use prompts or completions from this endpoint for training.', + status: 'public', + context_length: 1_050_000, + max_completion_tokens: 128_000, + gateway: 'vercel', + flags: ['reasoning', 'vision'], + pricing: { + tiers: [ + { + start_context_length: 0, + pricing: { + prompt_per_million: 2.5, + completion_per_million: 15, + input_cache_read_per_million: 0.25, + input_cache_write_per_million: 3.125, + }, + }, + { + start_context_length: 272_000, + pricing: { + prompt_per_million: 5, + completion_per_million: 22.5, + input_cache_read_per_million: 0.5, + input_cache_write_per_million: 6.25, + }, + }, + ], + }, + inference_provider_restriction: ['openai'], +}; diff --git a/apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts b/apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts index eecdc4a466..e9f98aef10 100644 --- a/apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts +++ b/apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts @@ -294,6 +294,17 @@ describe('applyVercelSettings managed requests', () => { expect(getVercelInferenceProvidersMock).toHaveBeenCalledWith('openai/gpt-5'); }); + it('does not add managed OpenAI BYOK to the discounted GPT-5.6 Sol endpoint', async () => { + process.env.OPENAI_API_KEY = 'openai-managed-key'; + const request = managedRequest({ only: ['openai'] }); + + await applyManagedVercelSettings('openai/gpt-5.6-sol-discounted', request); + + expect(request.body.model).toBe('openai/gpt-5.6-sol'); + expect(request.body.providerOptions?.gateway?.only).toEqual(['openai']); + expect(request.body.providerOptions?.gateway?.byok).toBeUndefined(); + }); + it('does not add managed OpenAI credentials when Vercel does not offer OpenAI', async () => { process.env.OPENAI_API_KEY = 'openai-managed-key'; const request = managedRequest(); diff --git a/apps/web/src/lib/ai-gateway/providers/vercel/index.ts b/apps/web/src/lib/ai-gateway/providers/vercel/index.ts index 684839fa91..245968c286 100644 --- a/apps/web/src/lib/ai-gateway/providers/vercel/index.ts +++ b/apps/web/src/lib/ai-gateway/providers/vercel/index.ts @@ -21,6 +21,7 @@ import type { AnthropicProviderOptions } from '@ai-sdk/anthropic'; import { getRuntimeGatewayRoutingConfig } from '@/lib/ai-gateway/providers/routing-config'; import { passesRoutingPercentage } from '@/lib/ai-gateway/providers/routing-percentage'; import { getEnvVariable } from '@/lib/dotenvx'; +import { gpt_5_6_sol_discounted_model } from '@/lib/ai-gateway/providers/openai-exclusive'; export function hasCompatibleVercelInferenceProvider( openRouterInferenceProviders: string[], @@ -266,9 +267,11 @@ export async function applyVercelSettings( const gatewayOptions = requestToMutate.body.providerOptions.gateway; const openAiApiKey = getEnvVariable('OPENAI_API_KEY'); + // OpenAI BYOK must also be disabled in the Vercel GUI so this model uses Vercel's discounted endpoint. if ( gatewayOptions && openAiApiKey && + requestedModel !== gpt_5_6_sol_discounted_model.public_id && vercelInferenceProviders?.includes('openai') && (!gatewayOptions.only || gatewayOptions.only.includes('openai')) ) { diff --git a/apps/web/src/tests/openrouter-models-config.test.ts b/apps/web/src/tests/openrouter-models-config.test.ts index 61f4dca91e..a26dac6a24 100644 --- a/apps/web/src/tests/openrouter-models-config.test.ts +++ b/apps/web/src/tests/openrouter-models-config.test.ts @@ -6,7 +6,7 @@ import { } from '@/lib/ai-gateway/providers/anthropic.constants'; import { deepseek_v4_pro_discounted_model } from '@/lib/ai-gateway/providers/deepseek'; import { GPT_CURRENT_MODEL_ID } from '@/lib/ai-gateway/providers/openai'; -import { gpt_5_6_sol_stealth_model } from '@/lib/ai-gateway/providers/openai-exclusive'; +import { gpt_5_6_sol_discounted_model } from '@/lib/ai-gateway/providers/openai-exclusive'; import { QWEN37_PLUS_MODEL_ID } from '@/lib/ai-gateway/providers/qwen'; import { tencent_hy3_free_model } from '@/lib/ai-gateway/providers/tencent'; @@ -37,13 +37,13 @@ describe('OpenRouter Models Config', () => { expect(preferredModels).not.toContain(model); }); - if (gpt_5_6_sol_stealth_model.status === 'public') { - expect(preferredModels).toContain(gpt_5_6_sol_stealth_model.public_id); + if (gpt_5_6_sol_discounted_model.status === 'public') { + expect(preferredModels).toContain(gpt_5_6_sol_discounted_model.public_id); expect(preferredModels.indexOf(GPT_CURRENT_MODEL_ID)).toBeLessThan( - preferredModels.indexOf(gpt_5_6_sol_stealth_model.public_id) + preferredModels.indexOf(gpt_5_6_sol_discounted_model.public_id) ); } else { - expect(preferredModels).not.toContain(gpt_5_6_sol_stealth_model.public_id); + expect(preferredModels).not.toContain(gpt_5_6_sol_discounted_model.public_id); } }); }); From 12667c22409a548bd04319ddb37f324beeeb522c Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Tue, 18 Aug 2026 16:32:05 +0200 Subject: [PATCH 2/4] fix(ai-gateway): remove GPT training claim --- apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts index 0e6195bfa2..474bef8504 100644 --- a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts +++ b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts @@ -41,7 +41,7 @@ export const gpt_5_6_sol_discounted_model: KiloExclusiveModel = { internal_id: 'openai/gpt-5.6-sol', display_name: 'OpenAI: GPT-5.6 Sol (50% off)', description: - 'GPT-5.6 Sol served by OpenAI through Vercel AI Gateway at 50% lower cost than other available inference providers. OpenAI does not use prompts or completions from this endpoint for training.', + 'GPT-5.6 Sol served by OpenAI through Vercel AI Gateway at 50% lower cost than other available inference providers.', status: 'public', context_length: 1_050_000, max_completion_tokens: 128_000, From b0cde352c46c69d4456454dcf0232274b903fbd9 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Tue, 18 Aug 2026 16:38:00 +0200 Subject: [PATCH 3/4] refactor(ai-gateway): split inference provider change --- apps/web/src/lib/ai-gateway/models.test.ts | 6 ------ .../src/lib/ai-gateway/providers/kilo-exclusive-model.ts | 9 --------- 2 files changed, 15 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/models.test.ts b/apps/web/src/lib/ai-gateway/models.test.ts index 7adf6a0312..5d1e626a3e 100644 --- a/apps/web/src/lib/ai-gateway/models.test.ts +++ b/apps/web/src/lib/ai-gateway/models.test.ts @@ -130,12 +130,6 @@ describe('isFreeModel', () => { flags: ['reasoning', 'vision'], inference_provider_restriction: ['openai'], }); - expect(getInferenceProvider(gpt_5_6_sol_discounted_model)).toEqual({ - slug: 'openai', - name: 'OPENAI', - training: false, - retainsPrompts: true, - }); expect( await hasBestEffortGuessDataCollectionRequirement(gpt_5_6_sol_discounted_model.public_id) ).toBe(false); diff --git a/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts b/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts index a4354687ad..ed498298f1 100644 --- a/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts +++ b/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.ts @@ -194,15 +194,6 @@ export function getInferenceProvider(model: KiloExclusiveModel): InferenceProvid if (model.flags.includes('stealth')) { return { slug: 'stealth', name: 'Stealth', training: true, retainsPrompts: true }; } - if (model.inference_provider_restriction.length === 1) { - const slug = model.inference_provider_restriction[0]; - return { - slug, - name: slug.toUpperCase(), - training: model.flags.includes('requires-data-collection'), - retainsPrompts: true, - }; - } if (model.gateway === 'openrouter' || model.gateway === 'vercel') { return null; } From 8236174e9906a2f6defc50c94fa3e0bb2caf43b2 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Tue, 18 Aug 2026 16:52:38 +0200 Subject: [PATCH 4/4] docs(ai-gateway): note GPT discount end date --- apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts index 474bef8504..b2bfebdf49 100644 --- a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts +++ b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts @@ -41,7 +41,7 @@ export const gpt_5_6_sol_discounted_model: KiloExclusiveModel = { internal_id: 'openai/gpt-5.6-sol', display_name: 'OpenAI: GPT-5.6 Sol (50% off)', description: - 'GPT-5.6 Sol served by OpenAI through Vercel AI Gateway at 50% lower cost than other available inference providers.', + 'GPT-5.6 Sol served by OpenAI through Vercel AI Gateway at 50% lower cost than other available inference providers. This promotion runs through September 18, 2026.', status: 'public', context_length: 1_050_000, max_completion_tokens: 128_000,