# Quickstart

From a new account to the first answer: unlock the organization, add credit, choose a model, create a key and send a request. The only guide with the complete request; the others link here.

## 1. Unlock the organization

Sign up and confirm your email address. Then open [Company details](https://tokenlane.de/settings/identity), enter the legal business name, address and registered country, and save. Company details are open to seats in the EU, the EEA and Switzerland; other seats are reviewed first. Buying credit by checkout currently supports a German seat; other seats need a billing review before they can pay. The page shows the organization's tier, its current limits and the next open step.

A new organization starts at tier T0 and cannot call models yet. It moves to T1 automatically with its first confirmed payment of the minimum amount named there. Until then every request fails with `403 permission_denied` and the message "This organization is suspended", even with a valid key.

## 2. Add credit

Open [Credits](https://tokenlane.de/settings/credits) and choose **Buy credits**. Before you pay on Mollie's checkout page, the dialog shows the allowed amounts, the top-up fee and the total. The credit appears when Mollie confirms the payment, not when you return from checkout. Owners and admins can buy credit.

If the dialog and the balance show **Test mode**, this instance takes Mollie test payments. Test credit is kept apart from live credit, and a test payment does not unlock the organization in step 1. To test requests there, ask support to unlock it and quote the customer ID from [Company details](https://tokenlane.de/settings/identity).

## 3. Choose a model

`GET /v1/models` lists the catalog without a key; [Models](https://tokenlane.de/models) adds prices in EUR. Copy an `id` exactly, without suffixes such as `:free`. A chat request needs `text` in both `architecture.input_modalities` and `architecture.output_modalities`; images, files, audio and embeddings have their own guides. The example below uses a model from the current catalog.

## 4. Create an inference key

Open [API Keys](https://tokenlane.de/keys), choose **New key** and name it. **Advanced settings** sets an expiration, a credit limit in EUR and the allowed models. The key starts with `sk-tl-v1-` and is shown once, so copy it into your secret manager. Only an inference key calls models; a management key cannot. Owners, admins and developers create inference keys. Key types and permissions: [Authentication](https://tokenlane.de/docs/guides/authentication.md?lang=en).

## 5. Send a request

Store the key in the environment variable `TOKENLANE_API_KEY`. Node.js and Python use the `openai` package, Vercel uses `ai` with `@ai-sdk/openai-compatible`, and cURL needs nothing installed. `YOUR_API_KEY` in the cURL example is a placeholder for your key, not a working value.

### curl

```curl
curl --request POST \
  --url 'https://api.tokenlane.de/v1/chat/completions' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "deepseek/deepseek-v4-flash-0731",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "max_tokens": 400
}'
```

### node

```node
import OpenAI from 'openai';

const client = new OpenAI({ baseURL: "https://api.tokenlane.de/v1", apiKey: process.env.TOKENLANE_API_KEY });
const response = await client.chat.completions.create({
  "model": "deepseek/deepseek-v4-flash-0731",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "max_tokens": 400
}, {});
console.log(response);
```

### python

```python
import os
import json
from openai import OpenAI

client = OpenAI(base_url="https://api.tokenlane.de/v1", api_key=os.environ["TOKENLANE_API_KEY"])
body = json.loads(r'''{
  "model": "deepseek/deepseek-v4-flash-0731",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "max_tokens": 400
}''')
response = client.chat.completions.create(
    model=body["model"],
    messages=body["messages"],
    max_tokens=body["max_tokens"]
)
print(response)
```

### vercel

```vercel
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { generateText } from 'ai';

const tokenlane = createOpenAICompatible({ name: 'tokenlane', baseURL: "https://api.tokenlane.de/v1", apiKey: process.env.TOKENLANE_API_KEY, includeUsage: true });
const result = await generateText({
  model: tokenlane("deepseek/deepseek-v4-flash-0731"),
  messages: [
  {
    "role": "user",
    "content": "Hello"
  }
],
  maxOutputTokens: 400,
});
console.log(result.text);
```

The answer is in `choices[0].message.content` and its charge in `usage.cost`, in the currency of `usage.currency` (always `EUR`). Shortened, a response looks like this; text, token counts and cost depend on the model:

```json
{
  "id": "gen-01m7kh5a9eepf9045s4a7vehem",
  "model": "deepseek/deepseek-v4-flash-0731",
  "choices": [{ "index": 0, "finish_reason": "stop", "message": { "role": "assistant", "content": "Hello! How can I help?" } }],
  "usage": { "prompt_tokens": 8, "completion_tokens": 7, "total_tokens": 15, "cost": 0.0000021, "currency": "EUR" }
}
```

The `x-request-id` header identifies the request for support. It also appears in [Activity](https://tokenlane.de/activity) and [Logs](https://tokenlane.de/logs).

## Tools

The same key and model ID also work with these OpenAI-compatible chat connections. Set the base URL to `https://api.tokenlane.de/v1` and use a Tokenlane inference key. Select a chat model from [Models](https://tokenlane.de/models); features such as tool calling depend on the selected model.

| Tool | Connection settings |
| --- | --- |
| LangChain | Use `ChatOpenAI` from `langchain-openai`. Set `base_url`, `api_key` and `model`. Keep `use_responses_api=False` for Chat Completions. [LangChain setup](https://docs.langchain.com/oss/python/integrations/chat/openai). |
| Pydantic AI | Use `OpenAIChatModel` with an `OpenAIProvider`. Set the provider's `base_url` and `api_key`, and the model ID on `OpenAIChatModel`. [Pydantic AI setup](https://ai.pydantic.dev/models/openai/). |
| n8n | Add an **OpenAI Chat Model** node and create OpenAI credentials. Set **Base URL** and **API Key** in those credentials, leave **Organization ID** empty, and enter the model ID manually. Turn **Use Responses API** off. [n8n setup](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatopenai/). |

These connections use `/chat/completions`. They do not enable provider-specific hosted tools such as web search or image generation. The linked project guides describe their settings; the base URL, key and model come from Tokenlane.

## If it fails

Every error carries `error.metadata.type`, a `remedy_hint` and the `request_id`. Check the type, not the message text.

| Status | `error.metadata.type` | Next step |
| --- | --- | --- |
| 400 | `model_not_found` | Copy the ID from the catalog; `remedy_hint` names the closest one. |
| 401 | `authentication` | Send `Authorization: Bearer` with the inference key from step 4. A missing header, a typo, a disabled or expired key and a management key all end here. |
| 402 | `insufficient_credits` | Buy credit (step 2) or raise the key's credit limit. The gateway reserves the highest possible cost first, so a lower `max_tokens` can also help. |
| 403 | `permission_denied` | "This organization is suspended" on a new organization: finish step 1; [Company details](https://tokenlane.de/settings/identity) names what is open. Otherwise the key's rules exclude the model, and `remedy_hint` names the allowed ones. |
| 404 | `not_found` | The path is wrong. Use `https://api.tokenlane.de/v1` as the complete base URL; `/api/v1` and `/v1/completions` do not exist here. |
| 429 | `rate_limited` | Wait the seconds in `Retry-After`, then retry with backoff and fewer parallel requests. The limits of your tier are listed under [Company details](https://tokenlane.de/settings/identity). |

Retry automatically only when `error.metadata.retryable` is `true`, as for 429; the other errors above need a change first. The SDKs raise errors as exceptions:

```ts
import OpenAI from 'openai';

try {
  // the client.chat.completions.create(...) call from step 5
} catch (error) {
  if (!(error instanceof OpenAI.APIError)) throw error;
  console.error(error.status, error.error?.metadata?.type, error.error?.metadata?.remedy_hint, error.requestID);
}
```

```python
import openai

try:
    ...  # the client.chat.completions.create(...) call from step 5
except openai.APIStatusError as error:
    metadata = (error.body or {}).get("metadata", {})
    print(error.status_code, metadata.get("type"), metadata.get("remedy_hint"), error.request_id)
```

The Vercel AI SDK raises an `APICallError` with `statusCode` and the error JSON in `responseBody`. All formats and retry rules: [Errors and retries](https://tokenlane.de/docs/guides/errors-and-retries.md?lang=en).

## Next

- [Streaming](https://tokenlane.de/docs/guides/streaming.md?lang=en)
- [Authentication](https://tokenlane.de/docs/guides/authentication.md?lang=en): key types, limits, expiry, management API
- [Move from OpenRouter](https://tokenlane.de/docs/guides/openrouter-migration.md?lang=en): what differs
- [Costs and limits](https://tokenlane.de/docs/guides/costs-and-limits.md?lang=en)