{"record":{"id":"997330a391bf96f3","repo":"Hmbown/CodeWhale","slug":"kimi-is-api-key-only-in-codewhale-create-a-key-at","errorCode":null,"errorMessage":"Kimi is API-key-only in Codewhale. Create a key at https://platform.kimi.ai/console/api-keys; Kimi CLI OAuth import is unsupported.","messagePattern":"Kimi is API-key-only in Codewhale\\. Create a key at https://platform\\.kimi\\.ai/console/api-keys; Kimi CLI OAuth import is unsupported\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":2523,"sourceCode":") -> Result<(codewhale_config::ExternalCredentialSource, PathBuf)> {\n    let (source, default_path) = match provider {\n        ProviderKind::OpenaiCodex => (\n            codewhale_config::ExternalCredentialSource::CodexCli,\n            openai_codex_auth_file_path(),\n        ),\n        ProviderKind::Xai => (\n            codewhale_config::ExternalCredentialSource::GrokCli,\n            grok_auth_file_path(),\n        ),\n        ProviderKind::Deepseek | ProviderKind::DeepseekAnthropic => (\n            codewhale_config::ExternalCredentialSource::DshCli,\n            codewhale_config::default_dsh_credentials_path(),\n        ),\n        ProviderKind::Antigravity => (\n            codewhale_config::ExternalCredentialSource::AgyCli,\n            codewhale_config::default_agy_credentials_path(),\n        ),\n        ProviderKind::Moonshot => bail!(\n            \"Kimi is API-key-only in Codewhale. Create a key at https://platform.kimi.ai/console/api-keys; Kimi CLI OAuth import is unsupported.\"\n        ),\n        _ => bail!(\n            \"{} has no supported external CLI credential source\",\n            provider.as_str()\n        ),\n    };\n    let path =\n        codewhale_config::resolve_external_credential_path(path_override.unwrap_or(default_path))?;\n    Ok((source, path))\n}\n\nfn provider_config_api_key(store: &ConfigStore, provider: ProviderKind) -> Option<&str> {\n    let slot = store\n        .config\n        .providers\n        .for_provider(provider)\n        .api_key","sourceCodeStart":2505,"sourceCodeEnd":2541,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/cli/src/lib.rs#L2505-L2541","documentation":"Codewhale deliberately refuses external CLI credential import for the Moonshot/Kimi provider: `external_credential_target` has no credential-source mapping for it because Kimi is API-key-only in Codewhale. The message points to the Kimi console where an API key can be created, since importing Kimi CLI OAuth state is unsupported.","triggerScenarios":"Any command that resolves an external CLI credential target for the Moonshot provider, e.g. configuring external credential access with `--provider kimi`/moonshot (the external-credentials surface or login-import path).","commonSituations":"Users who authenticated Kimi's own CLI trying to reuse that OAuth session in Codewhale; automation scripts that loop over all providers attempting credential import.","solutions":["Create an API key at https://platform.kimi.ai/console/api-keys","Store the key through Codewhale's own API-key path (e.g. `codewhale auth` API-key setup / `CODEWHALE_API_KEY`-style config for the provider) instead of CLI import","Update scripts to skip kimi/moonshot in provider-import loops"],"exampleFix":"# before\n$ codewhale external-credentials --provider kimi ...\n# Kimi is API-key-only in Codewhale...\n\n# after\n$ export MOONSHOT_API_KEY=sk-...   # or codewhale auth api-key flow\n$ codewhale --provider kimi exec \"hello\"","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nprovider=\"kimi\"\nif [ \"$provider\" = \"kimi\" ] || [ \"$provider\" = \"moonshot\" ]; then\n  [ -n \"$MOONSHOT_API_KEY\" ] || { echo \"set MOONSHOT_API_KEY (create at platform.kimi.ai)\" >&2; exit 1; }\nfi\ncodewhale --provider \"$provider\" exec \"hello\"","typeGuard":"fn supports_external_cli_import(provider: &str) -> bool {\n    matches!(provider, \"codex\" | \"grok\" | \"deepseek\" | \"dsh\" | \"antigravity\" | \"agy\")\n}","tryCatchPattern":null,"preventionTips":["Keep Kimi/Moonshot provisioning API-key-based from the start; do not plan around OAuth import","In multi-provider import scripts, special-case moonshot to configure an API key instead"],"tags":["kimi","moonshot","auth","oauth","api-key","unsupported"],"backgroundTag":"unsupported-auth-method","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}