Moonshot AI (Kimi) API keys

25 community-sourced Moonshot AI (Kimi) keys, re-checked against the API. Copy a key below, export it as MOONSHOT_API_KEY, and send requests to https://api.moonshot.ai/v1.

Keys

Using your Moonshot AI (Kimi) key

Export the key as MOONSHOT_API_KEY, then call the API at https://api.moonshot.ai/v1.

export MOONSHOT_API_KEY="your-key-here"

curl

curl https://api.moonshot.ai/v1/chat/completions \
  -H "Authorization: Bearer $MOONSHOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k3.1-pro",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

Python (OpenAI SDK)

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["MOONSHOT_API_KEY"],
    base_url="https://api.moonshot.ai/v1",
)

resp = client.chat.completions.create(
    model="kimi-k3.1-pro",
    messages=[{"role": "user", "content": "Say hello"}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.MOONSHOT_API_KEY,
  baseURL: "https://api.moonshot.ai/v1",
});

const resp = await client.chat.completions.create({
  model: "kimi-k3.1-pro",
  messages: [{ role: "user", content: "Say hello" }],
});
console.log(resp.choices[0].message.content);

Latest Moonshot AI (Kimi) models

Key collections