// How the model pickers sort models: by the connection that pays for a call (the owner's ChatGPT // plan, one of their own API keys, or Languid), with Languid's picks and recent choices first. /** Who pays for a call to this model, for this owner. */ export type Connection = 'chatgpt' | 'grok' | 'anthropic-key' | 'openrouter-key' | 'languid' /** The groups, in the order the pickers show them. */ export const CONNECTIONS: { id: Connection; label: string }[] = [ { id: 'chatgpt', label: 'ChatGPT plan' }, { id: 'grok', label: 'Grok plan' }, { id: 'anthropic-key', label: 'Your Claude key' }, { id: 'openrouter-key', label: 'Your OpenRouter key' }, { id: 'languid', label: 'Languid' }, ] /** The group of models Languid picks (LANGUID_HOUSE_MODELS), shown first, and its one-line note. */ export const HOUSE_LABEL = 'Picked by Languid' export const HOUSE_NOTE = 'Fast, cheap and tested here. Start with one of these.' /** How many recent choices the pickers remember, and show. */ export const RECENT_KEPT = 8 export const RECENT_SHOWN = 4 /** How many of a connected account's models the chat picker lists before "Show all". */ export const CONNECTION_SHOWN = 5 const MAKERS: Record = { anthropic: 'Anthropic', openai: 'OpenAI', 'openai-codex': 'OpenAI', google: 'Google', 'google-gemini-cli': 'Google', 'google-vertex': 'Google', deepseek: 'DeepSeek', 'meta-llama': 'Meta', mistral: 'Mistral', mistralai: 'Mistral', 'x-ai': 'xAI', xai: 'xAI', qwen: 'Qwen', moonshotai: 'Moonshot', 'z-ai': 'Z.ai', zai: 'Z.ai', minimax: 'MiniMax', nvidia: 'NVIDIA', cohere: 'Cohere', amazon: 'Amazon', microsoft: 'Microsoft', } /** Who made the model: OpenRouter's ids lead with it (`deepseek/deepseek-v4-flash`), others are the provider. */ export function makerOf(m: { provider: string; id: string }): string { // OpenRouter's "~maker/…" ids are aliases for a maker's latest model: the same maker. const key = (m.provider === 'openrouter' && m.id.includes('/') ? m.id.slice(0, m.id.indexOf('/')) : m.provider).replace(/^~/, '') return MAKERS[key] ?? key.charAt(0).toUpperCase() + key.slice(1) } /** The owner's recent models, newest first, with `value` (provider/id) moved to the front. */ export function pushRecent(recent: string[] | undefined, value: string): string[] { return [value, ...(recent ?? []).filter((v) => v !== value)].slice(0, RECENT_KEPT) }