> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get started with TokenLab API in 2 minutes

## Step 1: Start with Trial Credits

<Steps>
  <Step title="Create an account">
    Sign up at [tokenlab.sh](https://tokenlab.sh) using your email, Gmail, or GitHub account.
  </Step>

  <Step title="Use the included trial credits">
    Your account starts with trial credits for the first small test requests. You do not need to top up before Quickstart.
  </Step>

  <Step title="Create or copy an API key">
    Go to **Dashboard → API Keys** and create a new key, or copy an existing one. Copy it securely because full keys are only shown once.
  </Step>
</Steps>

<Warning>
  Keep your API key secure. Never expose it in client-side code or public repositories.
</Warning>

## Step 2: Install a Client

<CodeGroup>
  ```bash Python theme={null}
  pip install openai
  ```

  ```bash JavaScript theme={null}
  npm install openai
  ```

  ```bash Go theme={null}
  go get github.com/openai/openai-go/v3
  ```

  ```bash PHP theme={null}
  composer require openai-php/client
  ```
</CodeGroup>

## Step 3: Make Your First Request

For most new integrations, start with **Chat Completions** on `POST /v1/chat/completions`.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.tokenlab.sh/v1/chat/completions \
    -H "Authorization: Bearer sk-your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "messages": [
        {"role": "user", "content": "What is the capital of France?"}
      ]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="sk-your-api-key",
      base_url="https://api.tokenlab.sh/v1"
  )

  response = client.chat.completions.create(
      model="gpt-5.4",
      messages=[{"role": "user", "content": "What is the capital of France?"}]
  )

  print(response.choices[0].message.content)
  ```

  ```javascript JavaScript theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    apiKey: 'sk-your-api-key',
    baseURL: 'https://api.tokenlab.sh/v1'
  });

  const response = await client.chat.completions.create({
    model: 'gpt-5.4',
    messages: [{ role: 'user', content: 'What is the capital of France?' }],
  });

  console.log(response.choices[0].message.content);
  ```
</CodeGroup>

<Note>
  Use `POST /v1/responses` only when you explicitly need Responses-specific behavior. Some Responses-only fields depend on the selected model and routed path.
</Note>

## Top Up for Production

The included trial credits are for the first small tests. Add credits in **Dashboard → Billing** only when you are ready for production usage or higher-volume testing.

## Try Different Models

TokenLab supports hundreds of models. Change only the `model` field:

```python theme={null}
response = client.chat.completions.create(model="gpt-5.4", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="gpt-5-mini", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="claude-sonnet-4-6", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="gemini-3.5-flash", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="deepseek-r1", messages=[{"role": "user", "content": "Hello"}])
```

## Enable Streaming

```python theme={null}
stream = client.chat.completions.create(
    model="gpt-5.4",
    messages=[{"role": "user", "content": "Tell me a short story."}],
    stream=True
)

for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="")
```

## What’s Next?

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Learn about API key management and security.
  </Card>

  <Card title="OpenAI SDK" icon="code" href="/integrations/openai-sdk">
    Use OpenAI-compatible `/v1` routes with existing OpenAI SDKs.
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/introduction">
    Explore the full endpoint reference.
  </Card>

  <Card title="Models" icon="robot" href="https://tokenlab.sh/en/models">
    Browse current model availability and pricing.
  </Card>
</CardGroup>
