kimi-k2-0711-preview APICallError: Incorrect API key provided #658

Closed
opened 2026-02-16 17:27:46 -05:00 by yindo · 1 comment
Owner

Originally created by @jaysean1 on GitHub (Jul 12, 2025).

Originally assigned to: @thdxr on GitHub.

I used the configuration in config.json:
"moonshot": {
"npm": "@ai-sdk/openai-compatible",
"name": "Moonshot AI",
"api_key": "xxxxxx",
"options": {
"baseURL": "https://api.moonshot.cn/v1"
},
"models": {
"kimi-k2-0711-preview": {
"name": "Kimi K2"
}
}
}

I added the correct apikey, but the model returned:

Image
Originally created by @jaysean1 on GitHub (Jul 12, 2025). Originally assigned to: @thdxr on GitHub. I used the configuration in config.json: "moonshot": { "npm": "@ai-sdk/openai-compatible", "name": "Moonshot AI", "api_key": "xxxxxx", "options": { "baseURL": "https://api.moonshot.cn/v1" }, "models": { "kimi-k2-0711-preview": { "name": "Kimi K2" } } } ------------ I added the correct apikey, but the model returned: <img width="464" height="100" alt="Image" src="https://github.com/user-attachments/assets/08326ae6-8f82-44f8-b867-5b7387712352" />
yindo closed this issue 2026-02-16 17:27:46 -05:00
Author
Owner

@arielZusman commented on GitHub (Jul 12, 2025):

The api key should be in the options:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "moonshot": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "KIMI",
      "options": {
        "baseURL": "https://api.moonshot.ai/v1",
        "apiKey": "sk-*****"
      },
      "models": {
        "kimi-k2-0711-preview": {
          "name": "kimi-k2"
        }
      }
    }
  }
}
@arielZusman commented on GitHub (Jul 12, 2025): The api key should be in the options: ```json { "$schema": "https://opencode.ai/config.json", "provider": { "moonshot": { "npm": "@ai-sdk/openai-compatible", "name": "KIMI", "options": { "baseURL": "https://api.moonshot.ai/v1", "apiKey": "sk-*****" }, "models": { "kimi-k2-0711-preview": { "name": "kimi-k2" } } } } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#658