Get startedQuickstart

Quickstart

Get an API key, install a client, ship your first request in 60 seconds.

A working CleverRouter call needs three things: a key, an SDK (or just cURL), and a model id. This page walks all three.

Create an API key

Sign in to the dashboard, open Keys, click Create key. The key is shown exactly once — copy it directly into your secret manager (1Password, Doppler, AWS Secrets Manager).

export CLEVERROUTER_API_KEY=cr_live_XXXXXXXXXXXX

Server-only

cr_live_* keys belong on the server. Never ship them to a browser bundle. See Authentication for the security model and the right pattern for client-side AI.

Install a client

Pick the stack you already use. Anything OpenAI-compatible works too — just point baseURL at https://api.cleverouter.eu/v1.

bun add @cleverrouter/sdk@alpha openai
bun add @cleverrouter/sdk@alpha ai @ai-sdk/openai-compatible
bun add @cleverrouter/sdk@alpha @mastra/core
uv add openai
# Nothing to install — bring your own HTTP client.

Make your first call

mistral/mistral-small-3.2 is a cheap, fast EU-hosted chat model — a solid default for "hello world".

hello.ts
import { createCleverRouter } from '@cleverrouter/sdk';

const cr = createCleverRouter({
  apiKey: process.env.CLEVERROUTER_API_KEY!,
});

const res = await cr.chat({
  model: 'mistral/mistral-small-3.2',
  messages: [{ role: 'user', content: 'Bonjour from Paris.' }],
});

console.log(res.choices[0]?.message.content);
hello.ts
import { generateText } from 'ai';
import { createCleverRouterAI } from '@cleverrouter/sdk/ai-sdk';

const cr = createCleverRouterAI({
  apiKey: process.env.CLEVERROUTER_API_KEY!,
});

const { text } = await generateText({
  model: cr('mistral/mistral-small-3.2'),
  prompt: 'Bonjour from Paris.',
});
console.log(text);
agent.ts
import { Agent } from '@mastra/core/agent';
import { createCleverRouterMastra } from '@cleverrouter/sdk/mastra';

const cr = createCleverRouterMastra({
  apiKey: process.env.CLEVERROUTER_API_KEY!,
});

export const agent = new Agent({
  name: 'demo',
  model: cr('mistral/mistral-small-3.2'),
  instructions: 'You are helpful and reply in the user language.',
});
hello.py
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["CLEVERROUTER_API_KEY"],
    base_url="https://api.cleverouter.eu/v1",
)

res = client.chat.completions.create(
    model="mistral/mistral-small-3.2",
    messages=[{"role": "user", "content": "Bonjour from Paris."}],
)
print(res.choices[0].message.content)
curl https://api.cleverouter.eu/v1/chat/completions \
  -H "Authorization: Bearer $CLEVERROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral/mistral-small-3.2",
    "messages": [{ "role": "user", "content": "Bonjour from Paris." }]
  }'

You should now have

  • A cr_live_* key in your secret manager.
  • One successful chat completion against https://api.cleverouter.eu/v1/chat/completions.
  • A response with X-CleverRouter-Provider: scaleway (or tensorix / bedrock) in the headers, telling you which EU provider served the request.

Next steps