From 91e7a03b3212594f4b5e44c454baf57b05ed5118 Mon Sep 17 00:00:00 2001 From: chrarnoldus <12196001+chrarnoldus@users.noreply.github.com> Date: Mon, 7 Sep 2026 11:16:07 +0000 Subject: [PATCH 1/7] Add GPT-6 Astra Flex model Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com> --- apps/web/src/lib/ai-gateway/models.test.ts | 36 +++++++++++++++++- apps/web/src/lib/ai-gateway/models.ts | 7 +++- .../providers/kilo-exclusive-model.test.ts | 24 ++++++++++++ .../providers/kilo-exclusive-model.ts | 4 ++ .../ai-gateway/providers/openai-exclusive.ts | 37 +++++++++++++++++++ .../ai-gateway/providers/openrouter/types.ts | 15 +++++++- .../tests/openrouter-models-config.test.ts | 11 +++++- 7 files changed, 130 insertions(+), 4 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/models.test.ts b/apps/web/src/lib/ai-gateway/models.test.ts index ed67071f99..7fef488b46 100644 --- a/apps/web/src/lib/ai-gateway/models.test.ts +++ b/apps/web/src/lib/ai-gateway/models.test.ts @@ -18,7 +18,7 @@ import { claude_sonnet_4_6_stealth_model, claude_opus_4_6_stealth_model, } from './providers/anthropic.constants'; -import { gpt_5_6_sol_discounted_model } from './providers/openai-exclusive'; +import { gpt_5_6_sol_discounted_model, gpt_6_astra_flex_model } from './providers/openai-exclusive'; import { gemma_4_26b_a4b_it_free_model } from './providers/google'; import { isUnavailableModel } from './unavailable-models'; import { getRandomNumber } from './getRandomNumber'; @@ -156,6 +156,40 @@ describe('isFreeModel', () => { ]); }); + test('registers the GPT-6 Astra OpenAI Flex endpoint', async () => { + expect(findKiloExclusiveModel(gpt_6_astra_flex_model.public_id)).toBe(gpt_6_astra_flex_model); + expect(gpt_6_astra_flex_model).toMatchObject({ + internal_id: 'openai/gpt-6-astra', + gateway: 'openrouter', + flags: ['reasoning', 'vision', 'flex'], + inference_provider_restriction: ['openai'], + pricing: { fallbackOnly: true }, + }); + expect( + await hasBestEffortGuessDataCollectionRequirement(gpt_6_astra_flex_model.public_id) + ).toBe(false); + expect(gpt_6_astra_flex_model.pricing?.tiers).toEqual([ + { + start_context_length: 0, + pricing: { + prompt_per_million: 5, + completion_per_million: 25, + input_cache_read_per_million: 0.5, + input_cache_write_per_million: 6.25, + }, + }, + { + start_context_length: 272_000, + pricing: { + prompt_per_million: 10, + completion_per_million: 37.5, + input_cache_read_per_million: 1, + input_cache_write_per_million: 12.5, + }, + }, + ]); + }); + test('all Kilo exclusive models should have either no pricing or valid ordered pricing tiers', () => { for (const model of kiloExclusiveModels) { if (model.pricing) { diff --git a/apps/web/src/lib/ai-gateway/models.ts b/apps/web/src/lib/ai-gateway/models.ts index 2042999d36..a602e91239 100644 --- a/apps/web/src/lib/ai-gateway/models.ts +++ b/apps/web/src/lib/ai-gateway/models.ts @@ -26,7 +26,10 @@ import { stepfun_37_flash_free_model } from '@/lib/ai-gateway/providers/stepfun' 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_discounted_model } from '@/lib/ai-gateway/providers/openai-exclusive'; +import { + gpt_5_6_sol_discounted_model, + gpt_6_astra_flex_model, +} from '@/lib/ai-gateway/providers/openai-exclusive'; import { GLM_CURRENT_MODEL_ID } from '@/lib/ai-gateway/providers/zai'; import { type ProviderId } from '@/lib/ai-gateway/providers/types'; import type { OpenRouterReasoningConfig } from '@/lib/ai-gateway/providers/openrouter/types'; @@ -102,6 +105,7 @@ export const preferredModels = [ ...(gpt_5_6_sol_discounted_model.status === 'public' ? [gpt_5_6_sol_discounted_model.public_id] : []), + ...(gpt_6_astra_flex_model.status === 'public' ? [gpt_6_astra_flex_model.public_id] : []), GLM_CURRENT_MODEL_ID, KIMI_CURRENT_MODEL_ID, MINIMAX_CURRENT_MODEL_ID, @@ -137,6 +141,7 @@ export const kiloExclusiveModels = [ gemma_4_26b_a4b_it_free_model, qwen36_plus_stealth_model, gpt_5_6_sol_discounted_model, + gpt_6_astra_flex_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.test.ts b/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.test.ts index d7906d7d2b..61504ecc5f 100644 --- a/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.test.ts +++ b/apps/web/src/lib/ai-gateway/providers/kilo-exclusive-model.test.ts @@ -8,7 +8,9 @@ import { type PricingTiers, } from '@/lib/ai-gateway/providers/kilo-exclusive-model'; import type { + GatewayMessagesRequest, GatewayRequest, + GatewayResponsesRequest, OpenRouterChatCompletionRequest, OpenRouterProviderConfig, } from '@/lib/ai-gateway/providers/openrouter/types'; @@ -157,6 +159,28 @@ describe('applyKiloExclusiveModelSettings', () => { expect(req.body.model).toBe('vendor/real-model'); }); + it.each([ + { + kind: 'chat_completions' as const, + body: { model: 'kilo/test-model', messages: [] } as OpenRouterChatCompletionRequest, + }, + { + kind: 'responses' as const, + body: { model: 'kilo/test-model', input: '' } as GatewayResponsesRequest, + }, + { + kind: 'messages' as const, + body: { model: 'kilo/test-model', max_tokens: 1, messages: [] } as GatewayMessagesRequest, + }, + ])('sets the Flex service tier for $kind requests', request => { + applyKiloExclusiveModelSettings( + request, + makeModel({ internal_id: 'vendor/real-model', flags: ['flex'] }) + ); + + expect(request.body.service_tier).toBe('flex'); + }); + it('leaves provider untouched when there is no restriction', () => { const req = makeRequest({ only: ['anthropic'], zdr: true }); applyKiloExclusiveModelSettings(req, makeModel({ internal_id: 'vendor/x' })); 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 0b51d5b0d9..e1f6962a4c 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 @@ -11,6 +11,7 @@ import { export type KiloExclusiveModelFlag = | 'reasoning' | 'vision' + | 'flex' | 'stealth' | 'vercel-routing' | 'rate-limited' @@ -169,6 +170,9 @@ export function applyKiloExclusiveModelSettings( ) { requestToMutate.body.model = kiloExclusiveModel.internal_id; removeNonSensicalMaxTokens(requestToMutate, kiloExclusiveModel); + if (kiloExclusiveModel.flags.includes('flex')) { + requestToMutate.body.service_tier = 'flex'; + } const restriction = kiloExclusiveModel.inference_provider_restriction; if (restriction.length === 0) { return; 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 4941628aef..99c9a051ad 100644 --- a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts +++ b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts @@ -35,3 +35,40 @@ export const gpt_5_6_sol_discounted_model: KiloExclusiveModel = { }, inference_provider_restriction: ['openai'], }; + +export const gpt_6_astra_flex_model: KiloExclusiveModel = { + public_id: 'openai/gpt-6-astra-flex', + internal_id: 'openai/gpt-6-astra', + display_name: 'OpenAI: GPT-6 Astra Flex', + description: + 'GPT-6 Astra with OpenAI Flex processing, offering lower costs in exchange for slower response times and occasional resource unavailability.', + status: 'public', + context_length: 1_050_000, + max_completion_tokens: 128_000, + gateway: 'openrouter', + flags: ['reasoning', 'vision', 'flex'], + pricing: { + fallbackOnly: true, + tiers: [ + { + start_context_length: 0, + pricing: { + prompt_per_million: 5, + completion_per_million: 25, + input_cache_read_per_million: 0.5, + input_cache_write_per_million: 6.25, + }, + }, + { + start_context_length: 272_000, + pricing: { + prompt_per_million: 10, + completion_per_million: 37.5, + input_cache_read_per_million: 1, + input_cache_write_per_million: 12.5, + }, + }, + ], + }, + inference_provider_restriction: ['openai'], +}; diff --git a/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts b/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts index 0ec1f2e115..4d6e3794a7 100644 --- a/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts +++ b/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts @@ -57,6 +57,16 @@ export type OpenCodeSpecificProperties = { reasoningEffort?: string; }; +export type GatewayServiceTier = + | 'auto' + | 'default' + | 'flex' + | 'priority' + | 'fast' + | 'scale' + | 'standard_only' + | null; + export type SharedGatewayRequestProperties = { // https://openrouter.ai/docs/features/provider-routing#requiring-providers-to-comply-with-data-policies provider?: OpenRouterProviderConfig; @@ -66,6 +76,9 @@ export type SharedGatewayRequestProperties = { // https://openrouter.ai/docs/api/api-reference/chat/send-chat-completion-request#request.body.models models?: string[]; + // Supported by OpenRouter's Chat Completions, Responses, and Messages APIs. + service_tier?: GatewayServiceTier; + // Non-standard reasoning configuration enable_thinking?: boolean; // Alibaba thinking?: { type?: 'enabled' | 'adaptive' | 'disabled' }; // ByteDance, Z.ai @@ -75,7 +88,7 @@ export type GatewayResponsesRequest = SharedGatewayRequestProperties & OpenAI.Responses.ResponseCreateParams; export type GatewayMessagesRequest = SharedGatewayRequestProperties & - Anthropic.MessageCreateParams & { + Omit & { user?: string; session_id?: string; }; diff --git a/apps/web/src/tests/openrouter-models-config.test.ts b/apps/web/src/tests/openrouter-models-config.test.ts index b649f29d3c..86dcc43409 100644 --- a/apps/web/src/tests/openrouter-models-config.test.ts +++ b/apps/web/src/tests/openrouter-models-config.test.ts @@ -5,7 +5,10 @@ import { CLAUDE_SONNET_CURRENT_MODEL_ID, } from '@/lib/ai-gateway/providers/anthropic.constants'; import { GPT_CURRENT_MODEL_ID } from '@/lib/ai-gateway/providers/openai'; -import { gpt_5_6_sol_discounted_model } from '@/lib/ai-gateway/providers/openai-exclusive'; +import { + gpt_5_6_sol_discounted_model, + gpt_6_astra_flex_model, +} from '@/lib/ai-gateway/providers/openai-exclusive'; import { QWEN37_PLUS_MODEL_ID } from '@/lib/ai-gateway/providers/qwen'; describe('OpenRouter Models Config', () => { @@ -43,5 +46,11 @@ describe('OpenRouter Models Config', () => { } else { expect(preferredModels).not.toContain(gpt_5_6_sol_discounted_model.public_id); } + + if (gpt_6_astra_flex_model.status === 'public') { + expect(preferredModels).toContain(gpt_6_astra_flex_model.public_id); + } else { + expect(preferredModels).not.toContain(gpt_6_astra_flex_model.public_id); + } }); }); From ac330c577c5c239f2c579e129487af1dc3c3d28b Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Mon, 7 Sep 2026 13:39:37 +0200 Subject: [PATCH 2/7] Remove slop --- .../lib/ai-gateway/providers/openrouter/types.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts b/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts index 4d6e3794a7..0ec1f2e115 100644 --- a/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts +++ b/apps/web/src/lib/ai-gateway/providers/openrouter/types.ts @@ -57,16 +57,6 @@ export type OpenCodeSpecificProperties = { reasoningEffort?: string; }; -export type GatewayServiceTier = - | 'auto' - | 'default' - | 'flex' - | 'priority' - | 'fast' - | 'scale' - | 'standard_only' - | null; - export type SharedGatewayRequestProperties = { // https://openrouter.ai/docs/features/provider-routing#requiring-providers-to-comply-with-data-policies provider?: OpenRouterProviderConfig; @@ -76,9 +66,6 @@ export type SharedGatewayRequestProperties = { // https://openrouter.ai/docs/api/api-reference/chat/send-chat-completion-request#request.body.models models?: string[]; - // Supported by OpenRouter's Chat Completions, Responses, and Messages APIs. - service_tier?: GatewayServiceTier; - // Non-standard reasoning configuration enable_thinking?: boolean; // Alibaba thinking?: { type?: 'enabled' | 'adaptive' | 'disabled' }; // ByteDance, Z.ai @@ -88,7 +75,7 @@ export type GatewayResponsesRequest = SharedGatewayRequestProperties & OpenAI.Responses.ResponseCreateParams; export type GatewayMessagesRequest = SharedGatewayRequestProperties & - Omit & { + Anthropic.MessageCreateParams & { user?: string; session_id?: string; }; From 1141f4bf313ba67d84e77330728a0c6babbf3620 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Tue, 8 Sep 2026 11:33:20 +0200 Subject: [PATCH 3/7] Update openai-exclusive.ts --- 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 99c9a051ad..96cad29c90 100644 --- a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts +++ b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts @@ -45,7 +45,7 @@ export const gpt_6_astra_flex_model: KiloExclusiveModel = { status: 'public', context_length: 1_050_000, max_completion_tokens: 128_000, - gateway: 'openrouter', + gateway: 'vercel', flags: ['reasoning', 'vision', 'flex'], pricing: { fallbackOnly: true, From d43de68bcb7d29c593bb51c379bca829aa4d5892 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Tue, 8 Sep 2026 12:08:12 +0200 Subject: [PATCH 4/7] Fix GPT-6 Astra gateway test --- apps/web/src/lib/ai-gateway/models.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/lib/ai-gateway/models.test.ts b/apps/web/src/lib/ai-gateway/models.test.ts index 7fef488b46..d9b17f699f 100644 --- a/apps/web/src/lib/ai-gateway/models.test.ts +++ b/apps/web/src/lib/ai-gateway/models.test.ts @@ -160,7 +160,7 @@ describe('isFreeModel', () => { expect(findKiloExclusiveModel(gpt_6_astra_flex_model.public_id)).toBe(gpt_6_astra_flex_model); expect(gpt_6_astra_flex_model).toMatchObject({ internal_id: 'openai/gpt-6-astra', - gateway: 'openrouter', + gateway: 'vercel', flags: ['reasoning', 'vision', 'flex'], inference_provider_restriction: ['openai'], pricing: { fallbackOnly: true }, From ea08abc60847d0582b9ad0cab48fb9e9000a4ba0 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Wed, 9 Sep 2026 15:45:37 +0200 Subject: [PATCH 5/7] Convert service tier to Vercel options --- apps/web/src/lib/ai-gateway/providers/vercel/index.ts | 2 ++ 1 file changed, 2 insertions(+) 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 83ed0a20c8..57679791e0 100644 --- a/apps/web/src/lib/ai-gateway/providers/vercel/index.ts +++ b/apps/web/src/lib/ai-gateway/providers/vercel/index.ts @@ -178,6 +178,7 @@ export function convertProviderOptions( ); })(); + const serviceTier = requestToMutate.body.service_tier; return { gateway: { only, @@ -186,6 +187,7 @@ export function convertProviderOptions( zeroDataRetention: provider?.zdr, disallowPromptTraining: provider?.data_collection === 'deny' || undefined, models: requestToMutate.body.models, + serviceTier: serviceTier === 'flex' || serviceTier === 'priority' ? serviceTier : undefined, }, }; } From 2987508ecf82c881153312083114f76225297e1e Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Wed, 9 Sep 2026 16:19:27 +0200 Subject: [PATCH 6/7] Remove unsupported request service tiers --- .../apply-provider-specific-logic.test.ts | 57 ++++++++++++++++++- .../apply-provider-specific-logic.ts | 33 ++++++++++- 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts index 7fa71cb9f0..8688ecb38a 100644 --- a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts +++ b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts @@ -1,10 +1,11 @@ -import { describe, expect, it } from '@jest/globals'; +import { describe, expect, it, jest } from '@jest/globals'; import { CLAUDE_OPUS_FALLBACK_MODEL_ID } from '@/lib/ai-gateway/providers/anthropic.constants'; import { applyAnthropicThinkingDefault, applyGatewayModelsFallback, applyPreferredProvider, applyReasoningDetailsTransform, + removeUnsupportedRequestServiceTier, } from '@/lib/ai-gateway/providers/apply-provider-specific-logic'; import type { GatewayRequest } from '@/lib/ai-gateway/providers/openrouter/types'; import { @@ -13,6 +14,11 @@ import { type ProviderId, } from '@/lib/ai-gateway/providers/types'; import { PERPLEXITY_KIMI_PUBLIC_ID } from '@/lib/ai-gateway/providers/partner/constants'; +import { QWEN37_MAX_MODEL_ID } from '@/lib/ai-gateway/custom-pricing'; +import { + gpt_5_6_sol_discounted_model, + gpt_6_astra_flex_model, +} from '@/lib/ai-gateway/providers/openai-exclusive'; function makeRequest(model: string, models?: string[]): GatewayRequest { return { @@ -85,6 +91,55 @@ describe('applyAnthropicThinkingDefault', () => { ); }); +describe('removeUnsupportedRequestServiceTier', () => { + it.each([ + { + model: QWEN37_MAX_MODEL_ID, + kiloExclusiveModel: null, + reason: 'non-fallback custom pricing', + }, + { + model: gpt_5_6_sol_discounted_model.public_id, + kiloExclusiveModel: gpt_5_6_sol_discounted_model, + reason: 'non-Flex Kilo-exclusive model', + }, + ])( + 'removes and logs the request-level tier for $reason', + ({ model, kiloExclusiveModel, reason }) => { + const request = makeRequest(model); + request.body.service_tier = 'priority'; + const warn = jest.spyOn(console, 'warn').mockImplementation(() => undefined); + + removeUnsupportedRequestServiceTier(model, request, kiloExclusiveModel); + + expect(request.body.service_tier).toBeUndefined(); + expect(warn).toHaveBeenCalledWith( + '[applyProviderSpecificLogic] Removed unsupported request-level service tier', + { + model, + requestKind: 'chat_completions', + serviceTier: 'priority', + reason, + } + ); + warn.mockRestore(); + } + ); + + it.each([ + [PERPLEXITY_KIMI_PUBLIC_ID, null], + [gpt_6_astra_flex_model.public_id, gpt_6_astra_flex_model], + ['vendor/standard-model', null], + ] as const)('preserves the request-level tier for %s', (model, kiloExclusiveModel) => { + const request = makeRequest(model); + request.body.service_tier = 'priority'; + + removeUnsupportedRequestServiceTier(model, request, kiloExclusiveModel); + + expect(request.body.service_tier).toBe('priority'); + }); +}); + describe('applyReasoningDetailsTransform', () => { function makeProvider(responseTransforms: Provider['responseTransforms']): Provider { return { diff --git a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts index 2e542762f6..dfa5b49a2f 100644 --- a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts +++ b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts @@ -7,7 +7,10 @@ import { } from '@/lib/ai-gateway/providers/openrouter/types'; import { applyMistralModelSettings, isMistralModel } from '@/lib/ai-gateway/providers/mistral'; import { findKiloExclusiveModel } from '@/lib/ai-gateway/models'; -import { applyKiloExclusiveModelSettings } from '@/lib/ai-gateway/providers/kilo-exclusive-model'; +import { + applyKiloExclusiveModelSettings, + type KiloExclusiveModel, +} from '@/lib/ai-gateway/providers/kilo-exclusive-model'; import { applyAnthropicModelSettings } from '@/lib/ai-gateway/providers/anthropic'; import { CLAUDE_OPUS_FALLBACK_MODEL_ID, @@ -49,6 +52,7 @@ import { isFreeModel } from '@/lib/ai-gateway/is-free-model'; import { isOpenAiModel } from '@/lib/ai-gateway/providers/openai'; import { ReasoningFormat } from '@/lib/ai-gateway/custom-llm/format'; import { ReasoningDetailType } from '@/lib/ai-gateway/custom-llm/reasoning-details'; +import { getCustomPricing } from '@/lib/ai-gateway/custom-pricing'; function isRecord(value: unknown): value is Record { return typeof value === 'object' && value !== null && !Array.isArray(value); @@ -223,6 +227,32 @@ export function applyAnthropicThinkingDefault( } } +export function removeUnsupportedRequestServiceTier( + requestedModel: string, + requestToMutate: GatewayRequest, + kiloExclusiveModel: KiloExclusiveModel | null +) { + const customPricing = getCustomPricing(requestedModel); + const reason = + customPricing && !customPricing.fallbackOnly + ? 'non-fallback custom pricing' + : kiloExclusiveModel && !kiloExclusiveModel.flags.includes('flex') + ? 'non-Flex Kilo-exclusive model' + : null; + const serviceTier = requestToMutate.body.service_tier; + if (!reason || serviceTier === undefined) { + return; + } + + console.warn('[applyProviderSpecificLogic] Removed unsupported request-level service tier', { + model: requestedModel, + requestKind: requestToMutate.kind, + serviceTier, + reason, + }); + delete requestToMutate.body.service_tier; +} + /** * Inverse of the reasoning-content response transform: folds * client-supplied `reasoning_details` back into the `reasoning_content` string @@ -288,6 +318,7 @@ export async function applyProviderSpecificLogic( enableReasoningSummaries(requestToMutate); const kiloExclusiveModel = findKiloExclusiveModel(requestedModel); + removeUnsupportedRequestServiceTier(requestedModel, requestToMutate, kiloExclusiveModel); if (kiloExclusiveModel) { applyKiloExclusiveModelSettings(requestToMutate, kiloExclusiveModel); } From f9135c2af9ae4eaa32cef4889d3526ba5066a4fc Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Thu, 10 Sep 2026 10:43:54 +0200 Subject: [PATCH 7/7] Disable GPT-6 Astra Flex --- apps/web/src/lib/ai-gateway/models.test.ts | 5 +++-- apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/models.test.ts b/apps/web/src/lib/ai-gateway/models.test.ts index a5a26ce7ab..b5aa10dfed 100644 --- a/apps/web/src/lib/ai-gateway/models.test.ts +++ b/apps/web/src/lib/ai-gateway/models.test.ts @@ -152,9 +152,10 @@ describe('isFreeModel', () => { ]); }); - test('registers the GPT-6 Astra OpenAI Flex endpoint', async () => { - expect(findKiloExclusiveModel(gpt_6_astra_flex_model.public_id)).toBe(gpt_6_astra_flex_model); + test('keeps the GPT-6 Astra OpenAI Flex endpoint disabled', async () => { + expect(findKiloExclusiveModel(gpt_6_astra_flex_model.public_id)).toBeNull(); expect(gpt_6_astra_flex_model).toMatchObject({ + status: 'disabled', internal_id: 'openai/gpt-6-astra', gateway: 'vercel', flags: ['reasoning', 'vision', 'flex'], 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 96cad29c90..73059a39b1 100644 --- a/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts +++ b/apps/web/src/lib/ai-gateway/providers/openai-exclusive.ts @@ -42,7 +42,7 @@ export const gpt_6_astra_flex_model: KiloExclusiveModel = { display_name: 'OpenAI: GPT-6 Astra Flex', description: 'GPT-6 Astra with OpenAI Flex processing, offering lower costs in exchange for slower response times and occasional resource unavailability.', - status: 'public', + status: 'disabled', context_length: 1_050_000, max_completion_tokens: 128_000, gateway: 'vercel',