> ## 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.

# クイックスタート

> 2分でTokenLab APIを始める

## ステップ 1: トライアルクレジットから始める

<Steps>
  <Step title="アカウントを作成">
    サインアップは [tokenlab.sh](https://tokenlab.sh) で、メール、Gmail、または GitHub アカウントを使用して行ってください。
  </Step>

  <Step title="付与されたトライアルクレジットを使う">
    新しいアカウントには、最初の小さなテストリクエストに使えるトライアルクレジットが含まれます。Quickstart の前にチャージする必要はありません。
  </Step>

  <Step title="APIキーを作成またはコピー">
    **ダッシュボード → API Keys** に移動して新しいキーを作成するか、既存のキーをコピーしてください。フルキーは一度しか表示されないため、安全に保管してください。
  </Step>
</Steps>

<Warning>
  APIキーを安全に保管してください。クライアント側のコードや公開リポジトリに絶対に露出しないでください。
</Warning>

## ステップ 2: クライアントをインストールする

<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>

## ステップ 3: 最初のリクエストを行う

ほとんどの新しい統合では、`POST /v1/chat/completions` の **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>
  Responses 固有の挙動が明示的に必要な場合に限り `POST /v1/responses` を使用してください。Responses 専用のフィールドの一部は、選択したモデルやルーティングされたパスに依存します。
</Note>

## 本番利用のためにチャージする

付与されたトライアルクレジットは、最初の小さなテスト向けです。本番利用や高頻度のテストに進む準備ができたら、**ダッシュボード → Billing** でクレジットを追加してください。

## さまざまなモデルを試す

TokenLab は300件以上のモデルをサポートしています。`model` フィールドだけを変更してください:

```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"}])
```

## ストリーミングを有効にする

```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="")
```

## 次に行うこと

<CardGroup cols={2}>
  <Card title="認証" icon="key" href="/authentication">
    APIキーの管理とセキュリティについて学んでください。
  </Card>

  <Card title="OpenAI SDK" icon="code" href="/integrations/openai-sdk">
    既存の OpenAI SDK で OpenAI 互換の `/v1` ルートを使用します。
  </Card>

  <Card title="API リファレンス" icon="book" href="/api-reference/introduction">
    エンドポイントの完全なリファレンスを参照してください。
  </Card>

  <Card title="モデル" icon="robot" href="https://tokenlab.sh/ja/models">
    現在のモデルの利用可能性と価格を確認してください。
  </Card>
</CardGroup>
