Skip to main content

Use Kimi K2.6 and K3 through an OpenAI-compatible API: curl, the OpenAI SDK, Cline and Aider

One base URL, one key, two Kimi model IDs, and the exact settings for your coding agent

Updated 4 min readMarkdown
Use Kimi K2.6 and K3 through an OpenAI-compatible API: curl, the OpenAI SDK, Cline and Aider

Adapted from our CloudGPU blog post on Kimi K2.

If a tool already speaks the OpenAI-compatible chat format, switching it to Kimi comes down to three values: the base URL, the API key and the model ID. This post shows those values on the CloudGPU gateway, then the same setup in curl, the openai Python package, Cline and Aider.

Disclosure: I work on CloudGPU.

The three values

Setting Value
Base URL https://cloudgpu.app/v1
API key a cgw-sk-... key from the API console, kept in $CGW_API_KEY
Model ID kimi-k2.6 or kimi-k3

Both IDs are in the model table on the live API page (checked 2026-10-27), which also lists kimi-k2.5. The original post suggests kimi-k2.6 for everyday coding agents and kimi-k3 for harder reasoning tasks.

A team test on 2026-10-26 with an internal key found both IDs in /v1/models, a working chat request, and a single tool call (the tools parameter, returning tool_calls) for each.

Step 1: Get a key

  1. Sign up at cloudgpu.app with an email address or a Google account.
  2. Top up the prepaid balance. Payment options are card or USDT.
  3. In the API console, create a key. It starts with cgw-sk- and is shown only once, so copy it straight away.
  4. Keep it in an environment variable:
export CGW_API_KEY="cgw-sk-..."

The same balance pays for the API per token and for rented GPUs by the minute.

Step 2: Check the key with curl

curl https://cloudgpu.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $CGW_API_KEY" \
  -d '{
    "model": "kimi-k2.6",
    "messages": [{"role": "user", "content": "Refactor this function to use early returns."}]
  }'

If something is off, the error codes from the API docs tell you what:

  • 401 missing_authorization: no Authorization header was sent.
  • 401 invalid_api_key: the key is unknown or revoked.
  • 400 model_not_found: the model ID is not in the catalog. Copy it from the model table.
  • 429 rate_limit_exceeded: you hit the per-minute or per-day limit. The public beta defaults are 100 requests per minute per key and 10,000 requests per day per account.

Step 3: The OpenAI Python SDK

Only base_url and api_key change:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://cloudgpu.app/v1",
    api_key=os.environ["CGW_API_KEY"],
)

resp = client.chat.completions.create(
    model="kimi-k3",
    messages=[{"role": "user", "content": "Explain this stack trace in two sentences."}],
    max_tokens=2048,
)
print(resp.choices[0].message.content)

For streaming, pass stream=True. The API docs say the response is Server-Sent Events in OpenAI format and the SDK handles it for you.

If a reply comes back empty with finish_reason set to "length", the model ran out of output budget. Raise max_tokens and try again.

Step 4: Cline

According to the official Cline docs ("OpenAI Compatible" provider page, read 2026-10-27), the settings are in the Cline settings panel (the gear icon):

  1. API Provider: select "OpenAI Compatible".
  2. Base URL: https://cloudgpu.app/v1
  3. API Key: your cgw-sk-... key.
  4. Model: enter kimi-k2.6 (or kimi-k3).

The same docs list the usual fixes: "Invalid API Key" means the key or provider is wrong, and "Model Not Found" means the model ID isn't available at that base URL.

Step 5: Aider

According to the official Aider docs ("OpenAI compatible APIs", read 2026-10-27), set two environment variables and prefix the model name with openai/:

export OPENAI_API_BASE=https://cloudgpu.app/v1
export OPENAI_API_KEY=$CGW_API_KEY

aider --model openai/kimi-k2.6

On Windows the docs use setx OPENAI_API_BASE ... and setx OPENAI_API_KEY ..., then restart the shell.

What the gateway does and doesn't do

It speaks the OpenAI chat-completions format, streams tokens, and bills per token from a prepaid balance with no subscription. It doesn't store your prompts or train on them, and there is no automatic failover. Per-token rates for every model are listed on the API page and can change, so this post doesn't repeat them.

Model IDs, rates and the full docs: cloudgpu.app/api

FAQ

Which base URL do I use?https://cloudgpu.app/v1 for any OpenAI-compatible client.

Which model ID should I start with? The original post suggests kimi-k2.6 for everyday coding agents and kimi-k3 for harder reasoning. Both are in the live model table.

Does it work with the OpenAI SDK? Yes. Set base_url to https://cloudgpu.app/v1 and pass your cgw-sk- key as api_key.

How do I pay? From a prepaid balance, topped up by card or USDT.

No comments yet. Be the first to comment.