Kimi K2: AI_APICallError: Incorrect API key provided
I have trouble with running kimi models with their api.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:11434/v1"
},
"models": {
"qwen3:30b": {}
}
},
"moonshot": {
"id": "moonshot",
"api": "https://api.moonshot.cn/v1",
"npm": "@ai-sdk/openai-compatible",
"api_key": "sk-****",
"options": {
"baseURL": "https://api.moonshot.cn/v1"
},
"models": {
"kimi-k2-0711-preview": {
"name": "kimi-k2-0711-preview",
"cost": {
"input": 0.001953125,
"output": 0.009765625
}
}
}
}
}
}
that's not where you specify it - it's apiKey under options but also you can specify it with opencode auth login so you avoid hardcoding it into the config
you also don't need this config at all, moonshot works normally
same issue , not able to make moonshot kimi k2 model working!
I am facing a similar issue {"error":{"message":"Invalid Authentication","type":"invalid_authentication_error"}}
you also don't need this config at all, moonshot works normally
I'm using it directly via Moonshot, cannot set it upon entry, entering the provider and API key does not work and the opencode seems to be stuck in a loop, prompting to select a provider again
did anyone solve this problem?