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 apps/web/src/lib/ai-gateway/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@/lib/ai-gateway/auto-model';
import {
CLAUDE_OPUS_CURRENT_MODEL_ID,
claude_opus_4_7_optimized_model,
claude_sonnet_clawsetup_model,
CLAUDE_SONNET_CURRENT_MODEL_ID,
} from '@/lib/ai-gateway/providers/anthropic.constants';
Expand Down Expand Up @@ -81,6 +82,7 @@ export const kiloExclusiveModels = [
...alibabaDirectModels,
claude_sonnet_clawsetup_model,
stepfun_35_flash_free_model,
claude_opus_4_7_optimized_model,
] as KiloExclusiveModel[];

export function isKiloStealthModel(model: string): boolean {
Expand Down
37 changes: 36 additions & 1 deletion apps/web/src/lib/ai-gateway/providers/anthropic.constants.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
import type { KiloExclusiveModel } from '@/lib/ai-gateway/providers/kilo-exclusive-model';
import type {
KiloExclusiveModel,
Pricing,
Usage,
} from '@/lib/ai-gateway/providers/kilo-exclusive-model';

export const CLAUDE_SONNET_CURRENT_MODEL_ID = 'anthropic/claude-sonnet-4.6';
export const CLAUDE_OPUS_CURRENT_MODEL_ID = 'anthropic/claude-opus-4.7';
export const CLAUDE_HAIKU_CURRENT_MODEL_ID = 'anthropic/claude-haiku-4.5';

export const CLAUDE_OPUS_4_7_OPTIMIZED_MODEL_ID = 'anthropic/claude-opus-4-7:optimized';
Comment thread
arimesser marked this conversation as resolved.

export const CLAUDE_SONNET_CURRENT_VERCEL_MODEL_ID = CLAUDE_SONNET_CURRENT_MODEL_ID;
export const CLAUDE_OPUS_CURRENT_VERCEL_MODEL_ID = CLAUDE_OPUS_CURRENT_MODEL_ID;
export const CLAUDE_HAIKU_CURRENT_VERCEL_MODEL_ID = CLAUDE_HAIKU_CURRENT_MODEL_ID;

// Anthropic list price for Claude Opus 4.7, minus 20% Kilo discount.
const OPUS_4_7_OPTIMIZED_PRICING: Pricing = {
prompt_per_million: 4, // $5 list * 0.8
completion_per_million: 20, // $25 list * 0.8
input_cache_read_per_million: 0.4, // $0.50 list * 0.8
input_cache_write_per_million: 5, // $6.25 list * 0.8
calculate_mUsd: (usage: Usage) =>
usage.uncachedInputTokens * 4 +
usage.totalOutputTokens * 20 +
usage.cacheHitTokens * 0.4 +
usage.cacheWriteTokens * 5,
};

export const claude_opus_4_7_optimized_model: KiloExclusiveModel = {
public_id: CLAUDE_OPUS_4_7_OPTIMIZED_MODEL_ID,
internal_id: CLAUDE_OPUS_4_7_OPTIMIZED_MODEL_ID,
display_name: 'Claude Opus 4.7 Optimized',
description:
'A custom-optimized variant of Claude Opus 4.7, exclusively available on Kilo Code and hosted by a stealth inference partner. **Note:** This is a third-party optimized model and your prompts and completions may be used to train or improve the provider\'s services.',
context_length: 200_000,
max_completion_tokens: 32_000,
status: 'public',
flags: ['reasoning', 'vision'],
gateway: 'martian',
pricing: OPUS_4_7_OPTIMIZED_PRICING,
exclusive_to: [],
inference_provider_restriction: [],
};

export const claude_sonnet_clawsetup_model: KiloExclusiveModel = {
public_id: CLAUDE_SONNET_CURRENT_MODEL_ID + ':clawsetup',
internal_id: CLAUDE_SONNET_CURRENT_MODEL_ID,
Expand Down
17 changes: 16 additions & 1 deletion apps/web/src/lib/ai-gateway/providers/model-settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { isClaudeModel, isOpusModel } from '@/lib/ai-gateway/providers/anthropic.constants';
import {
isClaudeModel,
isOpusModel,
CLAUDE_OPUS_4_7_OPTIMIZED_MODEL_ID,
} from '@/lib/ai-gateway/providers/anthropic.constants';
import { isGemini3Model, isGemmaModel } from '@/lib/ai-gateway/providers/google';
import { isKimiModel } from '@/lib/ai-gateway/providers/moonshotai';
import { isOpenAiModel } from '@/lib/ai-gateway/providers/openai';
Expand Down Expand Up @@ -36,6 +40,17 @@ export const REASONING_VARIANTS_NONE_LOW_MEDIUM_HIGH = {
} as const;

export function getModelVariants(model: string): OpenCodeSettings['variants'] {
if (model === CLAUDE_OPUS_4_7_OPTIMIZED_MODEL_ID) {
// Default to 'high' reasoning for this Martian-optimized variant
return {
high: { reasoning: { enabled: true, effort: 'high' }, verbosity: 'high' },
xhigh: { reasoning: { enabled: true, effort: 'xhigh' }, verbosity: 'xhigh' },
max: { reasoning: { enabled: true, effort: 'xhigh' }, verbosity: 'max' },
medium: { reasoning: { enabled: true, effort: 'medium' }, verbosity: 'medium' },
low: { reasoning: { enabled: true, effort: 'low' }, verbosity: 'low' },
none: { reasoning: { enabled: false, effort: 'none' } },
};
}
if (isOpusModel(model) && model.includes('4.7')) {
return {
none: { reasoning: { enabled: false, effort: 'none' } },
Expand Down
Loading