{"record":{"id":"35f65405b6158319","repo":"Hmbown/CodeWhale","slug":"deepseek-api-key-not-found-1-get-a-key-https-platform","errorCode":null,"errorMessage":"DeepSeek API key not found.\n\n1. Get a key:  https://platform.deepseek.com/api_keys\n2. Save it (works in every folder, no OS prompts):\n       codewhale auth set --provider deepseek\n\nAlternatives:\n  • export DEEPSEEK_API_KEY=<your-key>      (current shell only;\n    also note: zsh users — exports in ~/.zshrc only reach interactive\n    shells, prefer ~/.zshenv for everything)\n  • api_key = \"<your-key>\"  in ~/.codewhale/config.toml\n  • already configured DeepSeek Harness? grant read-only access:\n       codewhale auth external-consent --provider deepseek --mode read-only","messagePattern":"DeepSeek API key not found\\.\n\n1\\. Get a key:  https://platform\\.deepseek\\.com/api_keys\n2\\. Save it \\(works in every folder, no OS prompts\\):\n       codewhale auth set --provider deepseek\n\nAlternatives:\n  • export DEEPSEEK_API_KEY=<your-key>      \\(current shell only;\n    also note: zsh users — exports in ~/\\.zshrc only reach interactive\n    shells, prefer ~/\\.zshenv for everything\\)\n  • api_key = \"<your-key>\"  in ~/\\.codewhale/config\\.toml\n  • already configured DeepSeek Harness\\? grant read-only access:\n       codewhale auth external-consent --provider deepseek --mode read-only","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":7337,"sourceCode":"        match provider {\n            ApiProvider::Codewhale => anyhow::bail!(\n                \"Codewhale API key not found, so no request was sent.\\n\\\n                 \\n\\\n                 The Codewhale API authenticates every model with one account \\\n                 API key carrying the `models:infer` scope.\\n\\\n                 \\n\\\n                 1. Create one and save it on this machine:\\n\\\n                        codewhale account api-keys create --name <name> --scope models:infer --use\\n\\\n                 2. Or export it for this shell:\\n\\\n                        export CODEWHALE_API_KEY=cwc_key_...\\n\\\n                 \\n\\\n                 You can also create a key at {} and put it in \\\n                 [providers.codewhale] api_key (or api_key_env).\",\n                provider\n                    .credential_url()\n                    .unwrap_or(\"https://app.codewhale.net/settings?section=api\")\n            ),\n            ApiProvider::Deepseek | ApiProvider::DeepseekCN => anyhow::bail!(\n                \"DeepSeek API key not found.\\n\\\n                 \\n\\\n                 1. Get a key:  https://platform.deepseek.com/api_keys\\n\\\n                 2. Save it (works in every folder, no OS prompts):\\n\\\n                        codewhale auth set --provider deepseek\\n\\\n                 \\n\\\n                 Alternatives:\\n\\\n                   • export DEEPSEEK_API_KEY=<your-key>      (current shell only;\\n\\\n                     also note: zsh users — exports in ~/.zshrc only reach interactive\\n\\\n                     shells, prefer ~/.zshenv for everything)\\n\\\n                   • api_key = \\\"<your-key>\\\"  in ~/.codewhale/config.toml\\n\\\n                   • already configured DeepSeek Harness? grant read-only access:\\n\\\n                        codewhale auth external-consent --provider deepseek --mode read-only\"\n            ),\n            ApiProvider::SiliconflowCn => anyhow::bail!(\n                \"SiliconFlow China API key not found. Get a key: {}. Run 'codewhale auth set --provider siliconflow-CN', \\\n                 set {}, or add [{}] api_key in ~/.codewhale/config.toml. \\\n                 [providers.siliconflow] remains a fallback when the CN table omits api_key.\",","sourceCodeStart":7319,"sourceCodeEnd":7355,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/config.rs#L7319-L7355","documentation":"DeepSeek (and DeepSeek CN) routes require a DeepSeek platform API key. When none is found in overrides, the DEEPSEEK_API_KEY env var, config.toml, the secret store, or an external-consent grant from DeepSeek Harness, the library fails before sending a request and lists every way to supply the key.","triggerScenarios":"Provider resolves to ApiProvider::Deepseek or ApiProvider::DeepseekCN and no credential is present in --api-key override, DEEPSEEK_API_KEY, [providers.deepseek] api_key/api_key_env, or stored auth.","commonSituations":"Fresh setup; zsh users who exported DEEPSEEK_API_KEY in ~/.zshrc so non-interactive/TUI sessions never see it; rotating keys on the DeepSeek platform and deleting the stored one.","solutions":["Get a key at https://platform.deepseek.com/api_keys, then run: codewhale auth set --provider deepseek","Export DEEPSEEK_API_KEY=<your-key> (zsh: put the export in ~/.zshenv so non-interactive shells see it).","Add api_key = \"<your-key>\" under [providers.deepseek] in ~/.codewhale/config.toml.","If DeepSeek Harness is already configured, grant read-only access: codewhale auth external-consent --provider deepseek --mode read-only."],"exampleFix":"// before (in ~/.zshrc — invisible to non-interactive shells)\nexport DEEPSEEK_API_KEY=sk-...\n\n// after (in ~/.zshenv)\nexport DEEPSEEK_API_KEY=sk-...","handlingStrategy":"validation","validationCode":"std::env::var(\"DEEPSEEK_API_KEY\")\n    .ok()\n    .filter(|k| !k.trim().is_empty())\n    .ok_or_else(|| \"DEEPSEEK_API_KEY missing; run codewhale auth set --provider deepseek\".to_string())?;","typeGuard":"fn deepseek_key_ready(env_val: Option<&str>) -> bool {\n    env_val.map(|k| k.starts_with(\"sk-\")).unwrap_or(false)\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"DeepSeek API key not found\") => {\n        eprintln!(\"export DEEPSEEK_API_KEY=... (put exports in ~/.zshenv on zsh)\");\n    }\n    other => other?,\n}","preventionTips":["Store the key durably with 'codewhale auth set --provider deepseek' instead of relying on shell exports.","On zsh, place exports in ~/.zshenv so TUI/CI launches see them.","Re-run auth set after rotating keys on the DeepSeek platform."],"tags":["api-key","deepseek","auth","shell"],"backgroundTag":"missing-api-key","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}