Skip to content

[ERROR] Query failed: litellm.AuthenticationError: AuthenticationError: MoonshotException - Invalid Authentication #196

Description

@orangezfj

use kimi model show this error

Activity

  1. KylinMountain commented on Jul 21, 2026

    @KylinMountain
    Collaborator

    @orangezfj would you help to pull request to fix this issue? Thank you

  2. KylinMountain commented on Jul 22, 2026

    @KylinMountain
    Collaborator

    Thanks for the report! This is almost always a region/endpoint mismatch, not a bad key.

    Kimi/Moonshot runs two separate platforms, each with its own keys:

    • International — platform.moonshot.ai → API base https://api.moonshot.ai/v1 (also https://api.kimi.ai/v1)
    • China — platform.moonshot.cn → API base https://api.moonshot.cn/v1

    LiteLLM's moonshot/ provider defaults to the .ai endpoint. If your key was issued on platform.moonshot.cn, it fails there with exactly this Invalid Authentication error.

    Could you confirm which platform your key is from — .ai or .cn?

    The fix depends on it:

    • .cn key — point OpenKB at the China endpoint via the OpenAI-compatible route:

      • in <kb>/.openkb/config.yaml: model: openai/kimi-k3 (or whatever Kimi model you use — kimi-k2.6, moonshot-v1-8k, …)
      • in your .env: OPENAI_API_BASE=https://api.moonshot.cn/v1

      (Or keep model: moonshot/kimi-k3 and instead add MOONSHOT_API_BASE=https://api.moonshot.cn/v1 to .env.)

    • .ai key — model: moonshot/kimi-k3 should work with the default endpoint; please double-check the key is active and has quota.

    Let us know your platform and we'll confirm the exact config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions