import { defineVendor } from '../define.js'

export default defineVendor({
  id: 'atlas-cloud',
  label: 'Atlas Cloud',
  classification: 'openai-compatible',
  defaultBaseUrl: 'https://api.atlascloud.ai/v1',
  defaultModel: 'deepseek-ai/deepseek-v4-pro',
  requiredEnvVars: ['ATLAS_CLOUD_API_KEY'],
  setup: {
    requiresAuth: true,
    authMode: 'api-key',
    credentialEnvVars: ['ATLAS_CLOUD_API_KEY'],
    dedicatedCredentialsOnly: true,
  },
  transportConfig: {
    kind: 'openai-compatible',
  },
  preset: {
    id: 'atlas-cloud',
    description: 'Atlas Cloud AI (OpenAI-compatible)',
    apiKeyEnvVars: ['ATLAS_CLOUD_API_KEY'],
    modelEnvVars: ['ATLAS_CLOUD_MODEL', 'OPENAI_MODEL'],
  },
  validation: {
    kind: 'credential-env',
    routing: {
      matchDefaultBaseUrl: true,
    },
    credentialEnvVars: ['ATLAS_CLOUD_API_KEY'],
    missingCredentialMessage:
      'Atlas Cloud auth is required. Set ATLAS_CLOUD_API_KEY.',
  },
  catalog: {
    source: 'static',
    // Mirrors https://www.atlascloud.ai/models/list/llm
    models: [
      { id: 'deepseek-ai/deepseek-v4-pro', apiName: 'deepseek-ai/deepseek-v4-pro', label: 'DeepSeek V4 Pro', contextWindow: 1_048_576, maxOutputTokens: 393_216, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'deepseek-ai/deepseek-v4-flash', apiName: 'deepseek-ai/deepseek-v4-flash', label: 'DeepSeek V4 Flash', contextWindow: 1_048_576, maxOutputTokens: 393_216, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'deepseek-ai/deepseek-v3.2', apiName: 'deepseek-ai/deepseek-v3.2', label: 'DeepSeek V3.2', contextWindow: 163_840, maxOutputTokens: 163_840, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'deepseek-ai/DeepSeek-V3.2-Exp', apiName: 'deepseek-ai/DeepSeek-V3.2-Exp', label: 'DeepSeek V3.2 Exp', contextWindow: 163_840, maxOutputTokens: 163_840, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'anthropic/claude-opus-4.8', apiName: 'anthropic/claude-opus-4.8', label: 'Claude Opus 4.8', contextWindow: 1_000_000, maxOutputTokens: 128_000 },
      { id: 'anthropic/claude-sonnet-4.6', apiName: 'anthropic/claude-sonnet-4.6', label: 'Claude Sonnet 4.6', contextWindow: 200_000, maxOutputTokens: 64_000 },
      { id: 'anthropic/claude-sonnet-4.6-coding', apiName: 'anthropic/claude-sonnet-4.6-coding', label: 'Claude Sonnet 4.6 Coding', contextWindow: 200_000, maxOutputTokens: 64_000 },
      { id: 'anthropic/claude-haiku-4.5-20251001', apiName: 'anthropic/claude-haiku-4.5-20251001', label: 'Claude Haiku 4.5', contextWindow: 200_000, maxOutputTokens: 64_000 },
      { id: 'anthropic/claude-haiku-4.5-20251001-coding', apiName: 'anthropic/claude-haiku-4.5-20251001-coding', label: 'Claude Haiku 4.5 Coding', contextWindow: 200_000, maxOutputTokens: 64_000 },
      { id: 'openai/gpt-5.5', apiName: 'openai/gpt-5.5', label: 'GPT 5.5', contextWindow: 1_050_000, maxOutputTokens: 128_000 },
      { id: 'openai/gpt-5.4', apiName: 'openai/gpt-5.4', label: 'GPT 5.4', contextWindow: 400_000, maxOutputTokens: 128_000 },
      { id: 'google/gemini-3.5-flash', apiName: 'google/gemini-3.5-flash', label: 'Gemini 3.5 Flash', contextWindow: 1_048_576, maxOutputTokens: 65_536 },
      { id: 'google/gemini-3.1-pro-preview', apiName: 'google/gemini-3.1-pro-preview', label: 'Gemini 3.1 Pro Preview', contextWindow: 1_000_000, maxOutputTokens: 64_000 },
      { id: 'google/gemini-3.1-flash-lite', apiName: 'google/gemini-3.1-flash-lite', label: 'Gemini 3.1 Flash Lite', contextWindow: 1_048_576, maxOutputTokens: 65_536 },
      { id: 'xai/grok-4.3', apiName: 'xai/grok-4.3', label: 'Grok 4.3', contextWindow: 1_000_000, maxOutputTokens: 1_000_000 },
      { id: 'xai/grok-build-0.1', apiName: 'xai/grok-build-0.1', label: 'Grok Build 0.1', contextWindow: 262_144, maxOutputTokens: 262_144, transportOverrides: { openaiShim: { removeBodyFields: ['reasoning_effort'] } } },
      { id: 'moonshotai/kimi-k2.7-code', apiName: 'moonshotai/kimi-k2.7-code', label: 'Kimi K2.7 Code', contextWindow: 262_144, maxOutputTokens: 262_144, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'moonshotai/kimi-k2.6', apiName: 'moonshotai/kimi-k2.6', label: 'Kimi K2.6', contextWindow: 262_144, maxOutputTokens: 262_144, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'moonshotai/kimi-k2.5', apiName: 'moonshotai/kimi-k2.5', label: 'Kimi K2.5', contextWindow: 262_144, maxOutputTokens: 262_144, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'zai-org/glm-5.2', apiName: 'zai-org/glm-5.2', label: 'GLM 5.2', contextWindow: 202_752, maxOutputTokens: 202_752, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'zai-org/glm-5.1', apiName: 'zai-org/glm-5.1', label: 'GLM 5.1', contextWindow: 202_752, maxOutputTokens: 202_752, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'zai-org/glm-5', apiName: 'zai-org/glm-5', label: 'GLM 5', contextWindow: 202_752, maxOutputTokens: 202_752, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'zai-org/glm-5-turbo', apiName: 'zai-org/glm-5-turbo', label: 'GLM 5 Turbo', contextWindow: 262_144, maxOutputTokens: 131_072, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'zai-org/glm-5v-turbo', apiName: 'zai-org/glm-5v-turbo', label: 'GLM 5V Turbo', contextWindow: 202_752, maxOutputTokens: 131_072, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'zai-org/glm-4.7', apiName: 'zai-org/glm-4.7', label: 'GLM 4.7', contextWindow: 202_752, maxOutputTokens: 202_752, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'zai-org/GLM-4.6', apiName: 'zai-org/GLM-4.6', label: 'GLM 4.6', contextWindow: 202_752, maxOutputTokens: 202_752, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'minimaxai/minimax-m3', apiName: 'minimaxai/minimax-m3', label: 'MiniMax M3', contextWindow: 524_288, maxOutputTokens: 524_288 },
      { id: 'minimaxai/minimax-m2.7', apiName: 'minimaxai/minimax-m2.7', label: 'MiniMax M2.7', contextWindow: 196_608, maxOutputTokens: 196_608, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'minimaxai/minimax-m2.5', apiName: 'minimaxai/minimax-m2.5', label: 'MiniMax M2.5', contextWindow: 196_608, maxOutputTokens: 196_608, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3.7-max', apiName: 'qwen/qwen3.7-max', label: 'Qwen3.7 Max', contextWindow: 1_000_000, maxOutputTokens: 67_072 },
      { id: 'qwen/qwen3.7-plus', apiName: 'qwen/qwen3.7-plus', label: 'Qwen3.7 Plus', contextWindow: 1_000_000, maxOutputTokens: 67_072 },
      { id: 'qwen/qwen3.6-plus', apiName: 'qwen/qwen3.6-plus', label: 'Qwen3.6 Plus', contextWindow: 1_000_000, maxOutputTokens: 65_536, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3.6-35b-a3b', apiName: 'qwen/qwen3.6-35b-a3b', label: 'Qwen3.6 35B A3B', contextWindow: 262_144, maxOutputTokens: 65_536, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3.5-397b-a17b', apiName: 'qwen/qwen3.5-397b-a17b', label: 'Qwen3.5 397B A17B', contextWindow: 262_144, maxOutputTokens: 65_536, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3.5-122b-a10b', apiName: 'qwen/qwen3.5-122b-a10b', label: 'Qwen3.5 122B A10B', contextWindow: 262_144, maxOutputTokens: 65_536, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3.5-35b-a3b', apiName: 'qwen/qwen3.5-35b-a3b', label: 'Qwen3.5 35B A3B', contextWindow: 262_144, maxOutputTokens: 65_536, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3.5-27b', apiName: 'qwen/qwen3.5-27b', label: 'Qwen3.5 27B', contextWindow: 262_144, maxOutputTokens: 65_536, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3-coder-next', apiName: 'qwen/qwen3-coder-next', label: 'Qwen3 Coder Next', contextWindow: 262_144, maxOutputTokens: 262_144, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'qwen/qwen3-max-2026-01-23', apiName: 'qwen/qwen3-max-2026-01-23', label: 'Qwen3 Max 2026-01-23', contextWindow: 252_000, maxOutputTokens: 32_000, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'qwen/qwen3-vl-30b-a3b-thinking', apiName: 'qwen/qwen3-vl-30b-a3b-thinking', label: 'Qwen3 VL 30B A3B Thinking', contextWindow: 128_000, maxOutputTokens: 32_000, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'qwen/qwen3-vl-30b-a3b-instruct', apiName: 'qwen/qwen3-vl-30b-a3b-instruct', label: 'Qwen3 VL 30B A3B Instruct', contextWindow: 128_000, maxOutputTokens: 32_000, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'qwen/qwen3-vl-8b-instruct', apiName: 'qwen/qwen3-vl-8b-instruct', label: 'Qwen3 VL 8B Instruct', contextWindow: 128_000, maxOutputTokens: 32_000, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'Qwen/Qwen3-VL-235B-A22B-Instruct', apiName: 'Qwen/Qwen3-VL-235B-A22B-Instruct', label: 'Qwen3 VL 235B A22B Instruct', contextWindow: 131_072, maxOutputTokens: 32_768, capabilities: { supportsVision: true, supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'Qwen/Qwen3-Next-80B-A3B-Thinking', apiName: 'Qwen/Qwen3-Next-80B-A3B-Thinking', label: 'Qwen3 Next 80B A3B Thinking', contextWindow: 262_144, maxOutputTokens: 32_768, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true, supportsReasoning: true } },
      { id: 'Qwen/Qwen3-Next-80B-A3B-Instruct', apiName: 'Qwen/Qwen3-Next-80B-A3B-Instruct', label: 'Qwen3 Next 80B A3B Instruct', contextWindow: 262_144, maxOutputTokens: 131_072, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'Qwen/Qwen3-30B-A3B-Instruct-2507', apiName: 'Qwen/Qwen3-30B-A3B-Instruct-2507', label: 'Qwen3 30B A3B Instruct 2507', contextWindow: 131_072, maxOutputTokens: 131_072, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'bytedance/doubao-seed-2.0-pro-260215', apiName: 'bytedance/doubao-seed-2.0-pro-260215', label: 'Doubao Seed 2.0 Pro', contextWindow: 262_144, maxOutputTokens: 131_072 },
      { id: 'bytedance/doubao-seed-2.0-code-preview-260215', apiName: 'bytedance/doubao-seed-2.0-code-preview-260215', label: 'Doubao Seed 2.0 Code Preview', contextWindow: 262_144, maxOutputTokens: 131_072 },
      { id: 'bytedance/doubao-seed-2.0-lite-260428', apiName: 'bytedance/doubao-seed-2.0-lite-260428', label: 'Doubao Seed 2.0 Lite', contextWindow: 262_144, maxOutputTokens: 131_072 },
      { id: 'bytedance/doubao-seed-2.0-mini-260428', apiName: 'bytedance/doubao-seed-2.0-mini-260428', label: 'Doubao Seed 2.0 Mini', contextWindow: 262_144, maxOutputTokens: 131_072 },
      { id: 'kwaipilot/kat-coder-pro-v2', apiName: 'kwaipilot/kat-coder-pro-v2', label: 'KAT Coder Pro V2', contextWindow: 262_144, maxOutputTokens: 144_000, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true } },
      { id: 'owl', apiName: 'owl', label: 'OWL', contextWindow: 1_048_576, maxOutputTokens: 262_144, capabilities: { supportsFunctionCalling: true, supportsJsonMode: true }, notes: 'Free' },
    ],
  },
  usage: { supported: false },
})
