Quickstart

Your first request in five minutes

All you need is an API key and a terminal. The examples use curl; any HTTP client works the same way.

  1. Create a workspace and a key

    Sign up, then create an API key in the dashboard. Keep it secret: anyone with the key can spend your balance.

  2. Choose how to pay

    Subscribe to a plan, or top up your prepaid balance. See pricing.

  3. Set two variables

    Your API base URL: API_BASE_URL

    shell
    export KEYDAN_API_KEY="YOUR_API_KEY"
    export KEYDAN_API_BASE="API_BASE_URL"
  4. Send a request

    Use the style your code already speaks. With the Chat Completions API:

    POST /v1/chat/completions
    curl "$KEYDAN_API_BASE/v1/chat/completions" \
      -H "Authorization: Bearer $KEYDAN_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "kd-balanced",
        "messages": [
          {"role": "system", "content": "You are a concise assistant."},
          {"role": "user", "content": "Say hello in three languages."}
        ]
      }'

    Not sure which model to pick? Send "model": "kd-auto" and the model is chosen for each request (how it works).

    Or with the Messages API:

    POST /v1/messages
    curl "$KEYDAN_API_BASE/v1/messages" \
      -H "x-api-key: $KEYDAN_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "kd-balanced",
        "max_tokens": 512,
        "system": "You are a concise assistant.",
        "messages": [
          {"role": "user", "content": "Say hello in three languages."}
        ]
      }'
  5. Stream the answer

    Add "stream": true to receive the answer as server-sent events while it is written.

    streaming
    curl -N "$KEYDAN_API_BASE/v1/chat/completions" \
      -H "Authorization: Bearer $KEYDAN_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model": "kd-balanced", "stream": true,
           "stream_options": {"include_usage": true},
           "messages": [{"role": "user", "content": "Count to three."}]}'
  6. Use an existing client

    Any client or library that lets you set a base URL for the Chat Completions format or the Messages format works, with your key as the API key. The base URL differs by format, because each kind of client adds its own path:

    • Chat Completions clients (they add /chat/completions): base URL API_BASE_URL/v1
    • Messages clients (they add /v1/messages): base URL API_BASE_URL, without /v1

Let your coding agent set it up

Paste this prompt into the coding agent you already use: it configures the project for Keydan, keeps the key out of the code and sends one test request.

setup prompt
Set up this project to call AI models through Keydan.

- API key: read it from the KEYDAN_API_KEY environment variable; never write it into code or commit it.
- Chat Completions clients: base URL API_BASE_URL/v1
- Messages clients: base URL API_BASE_URL (without /v1)
- Models: kd-auto picks the model for each request; explicitly, kd-balanced by default, kd-max for hard tasks, kd-fast for quick and cheap ones (GET /v1/models lists them).
- Fallbacks: send "models": ["kd-balanced", "kd-fast"] so a busy model hands the request to the next one.
- Errors: retry 429 and 503 with backoff and honour retry-after; send an Idempotency-Key header on retries.
- Long answers: use "stream": true.

Change the client configuration the project already has instead of adding a new library, then run one test
request and show me the answer.

Next steps

Ready-made scenarios: copy and hand to your agent

The six tasks people start with most often. Paste the text into Cline, Claude Code or any agent and it sets everything up on your key.

More prompts for agents →
Editor

VS Code in a minute

Cline or Roo Code on your key, kd-auto picks the model.

Set up Cline in this project for Keydan:
API type: OpenAI Compatible
Base URL: $KEYDAN_API_BASE/v1
Key: from the KEYDAN_API_KEY variable
Model: kd-auto
Check it with one short request and tell me it works.
Terminal

Claude Code on one key

Three variables, and the terminal agent works through Keydan.

export ANTHROPIC_BASE_URL=$KEYDAN_API_BASE
export ANTHROPIC_AUTH_TOKEN=$KEYDAN_API_KEY
export ANTHROPIC_MODEL=kd-max
claude
Code

A review of every pull request

The agent reads the diff and leaves comments in GitHub.

Add a GitHub Action to this repository: on every pull request take the diff, send it to Keydan
(Chat Completions, model kd-balanced, key from the KEYDAN_API_KEY secret)
and post a comment: bugs, risks, missing tests. If the diff is over 3,000 lines, list the files only.
Telegram

A support bot in an evening

Answers from your FAQ, hands hard questions to a person.

Build a Telegram bot in Python (aiogram): it answers customers from faq.md,
model kd-fast through Keydan ($KEYDAN_API_BASE/v1, key KEYDAN_API_KEY), remembers the last 10 messages,
forwards hard questions to the manager chat from .env. Add a Dockerfile.
Marketplaces

Product cards in bulk

Titles, descriptions and search keywords from a spreadsheet.

Take products.csv (name, specs, photo link). For every row, through Keydan (kd-balanced), write a title
up to 60 characters, a description up to 1,000 characters and 10 search keywords. Save to cards.csv.
Never invent specs that are not in the row.
Agents

A morning brief on competitors

Prices and new products since yesterday, straight to Telegram.

Every day at 8:00 open the sites from sites.txt, find price changes and new products since yesterday,
make a 10-point brief through Keydan (kd-fast) and send it to Telegram. Keep the previous state in state.json.