Kimi K3 in pi

Terminal coding agent · OpenAI-compatible custom provider · about 2 minutes

Before you start. Create an account (you get $2 to try), then open Token Management → Create token and copy the key. The key starts with sk-. Endpoints: OpenAI-compatible https://microquickjs.com/v1, Anthropic-compatible https://microquickjs.com. Model ID: Kimi-K3.

Option A: one command (pi package)

We publish pi-ainetcafe-provider, a pi package that registers the provider with the right compat settings and maps pi's thinking levels to K3's reasoning_effort. Source: GitHub.

export AINETCAFE_API_KEY=sk-your-ainetcafe-key
pi install npm:pi-ainetcafe-provider
pi
/model        # pick ainetcafe/Kimi-K3

Option B: models.json (no package)

pi registers custom providers in ~/.pi/agent/models.json. Add an ainetcafe provider that speaks the OpenAI Chat Completions API:

{
  "providers": {
    "ainetcafe": {
      "name": "ainetcafe",
      "baseUrl": "https://microquickjs.com/v1",
      "apiKey": "$AINETCAFE_API_KEY",
      "api": "openai-completions",
      "models": [
        {
          "id": "Kimi-K3",
          "name": "Kimi K3",
          "reasoning": true,
          "input": ["text", "image"],
          "cost": { "input": 2.10, "output": 10.50, "cacheRead": 0.30, "cacheWrite": 2.10 },
          "contextWindow": 262144,
          "maxTokens": 32768
        }
      ]
    }
  }
}

Export the key so the $AINETCAFE_API_KEY reference resolves, then start pi and pick the model with /model (or pass it at launch):

export AINETCAFE_API_KEY=sk-your-ainetcafe-key
pi --model ainetcafe/Kimi-K3

The cost block only drives pi's on-screen spend estimate; billing is always what the ainetcafe console shows.

Notes

Verify the key first

Thirty seconds now saves an hour of guessing later. Run this in a terminal; you should see a short reply and a usage block.

curl https://microquickjs.com/v1/chat/completions \
  -H "Authorization: Bearer $AINETCAFE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"Kimi-K3","messages":[{"role":"user","content":"Say OK"}],"max_tokens":5}'

If something goes wrong

SymptomCauseFix
401 Invalid tokenKey copied with a space, or key from another siteRe-copy from Token Management on microquickjs.com
403 quota / insufficient balanceWallet at zero or plan quota used upTop up in Wallet, or wait for the weekly plan reset
404 model not foundModel ID typed differentlyUse exactly Kimi-K3
429Rate limit for your tierReduce concurrency; limits rise with spend, or ask for a committed plan
Tool calls never happenTool calling disabled in the client, or thinking blocks strippedKeep the client's default tool settings; K3 returns a thinking block before tool_use, do not filter it out

Still stuck? Email [email protected] with the request ID from the error body.