How to hit the Moonshot AI (Kimi) API

Moonshot AI's Kimi models are served at https://api.moonshot.ai/v1 with an OpenAI-compatible API.

Authentication

Create a key at platform.kimi.ai. Send it as Authorization: Bearer <key>. In the examples it's written {{MOONSHOT_API_KEY}}.

Full reference: https://platform.kimi.ai/docs/api/chat

Chat completion

curl https://api.moonshot.ai/v1/chat/completions \
  -H "Authorization: Bearer {{MOONSHOT_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{"model": "kimi-k2.6", "messages": [{"role": "user", "content": "Explain what a webhook is in two sentences."}]}'
Run in PostTaco

List models

curl https://api.moonshot.ai/v1/models \
  -H "Authorization: Bearer {{MOONSHOT_API_KEY}}"
Run in PostTaco