Skip to content

Anthropic Messages with Keln

Use the Anthropic Messages API with Keln to run open models in your app or Claude Code. Set Keln's Anthropic base URL and API key, then choose a Keln model id. The API uses the same models and pricing as the other Keln APIs.

To use Keln with the desktop app, see Claude Desktop with Keln.

What you need to start

  • A Keln API key. Sign up at app.keln.ai, then open Keys → Create key.
  • Credit on your Keln account. Billing → Add credit.
  • For the request below, your key saved in the KELN_API_KEY environment variable.

Make a request

curl https://anthropic.keln.ai/v1/messages \
  -H "x-api-key: $KELN_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshotai/kimi-k3",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Say hello from Keln."}]
  }'

Use Claude Code

Claude Code runs on this API. Set these environment variables, with your Keln API key in place of sk-keln-…, then run claude as usual. You don't need a config file.

export ANTHROPIC_BASE_URL="https://anthropic.keln.ai"
export ANTHROPIC_API_KEY="sk-keln-…"          # your Keln API key
export ANTHROPIC_MODEL="moonshotai/kimi-k3"   # any catalog model with tool calling

Agent sessions need tool calling, so pick a model that supports it. For Claude Code's background tasks, you can set a cheaper catalog model with ANTHROPIC_SMALL_FAST_MODEL, for example deepseek-ai/deepseek-v4-flash.

Keln bills repeated context at the per-model cached rate automatically. Claude Code's WebSearch also works through Keln, at the price on the Web search page.

Choosing a model

Every model on Models & pricing is available on this API.

API reference

The Anthropic-compatible API page lists the supported features, including tools, thinking blocks, and usage fields.