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

# API リファレンス

> クライアントに合う BetterToken API を選びます。OpenAI 互換の Chat Completions・Responses と Anthropic 互換の Messages の接続方法を確認できます。

BetterToken は OpenAI-compatible Chat Completions と Responses API、および Anthropic-compatible Messages API を提供します。クライアントで使用する API 形式を選んでください。

## API を選択する

| API | POST | Auth |
| - | - | - |
| [Chat Completions](/ja/api-reference/chat-completions.md) | `/v1/chat/completions` | `Bearer` |
| [Responses](/ja/api-reference/responses.md) | `/v1/responses` | `Bearer` |
| [Messages](/ja/api-reference/messages.md) | `/v1/messages` | `x-api-key` |
| [Image generation](/ja/api-reference/images-generations.md) | `/v1/images/generations` | `Bearer` |
| [Image editing](/ja/api-reference/images-edits.md) | `/v1/images/edits` | `Bearer` |

## Chat Completions の接続情報

| 項目 | 値 |
| - | - |
| Base URL | `https://bettertoken.ai/v1` |
| 完全なリクエスト URL | `https://bettertoken.ai/v1/chat/completions` |
| メソッド | `POST` |
| 認証 | `Bearer YOUR_API_KEY` |
| モデル | `YOUR_MODEL_ID` |

現在の Model ID は、[model plaza](https://bettertoken.ai/pricing) または Console の API Key **Setup** ダイアログからコピーします。

> [!WARNING]
>
> 外部ツールで **Base URL** を求められた場合は、`https://bettertoken.ai/v1` を入力します。`https://bettertoken.ai/v1/chat/completions` は、完全なリクエスト URL を明示的に求められた場合だけ使ってください。

## 簡単なテスト

```bash theme={null}
curl "https://bettertoken.ai/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "model": "YOUR_MODEL_ID",
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ]
  }'
```

成功したレスポンスには `choices[0].message.content` が含まれます。

## 対話型テストと SDK の例

[OpenAI Chat Completions API](/ja/api-reference/chat-completions.md) を開くと、次の操作ができます。

* Playground からリクエストを送信する
* リクエストパラメーターとレスポンススキーマを確認する
* curl、Python、JavaScript の例をコピーする

> [!NOTE]
>
> 実際の API Key をドキュメント、スクリーンショット、公開コードに保存しないでください。`YOUR_API_KEY` と `YOUR_MODEL_ID` は実際の値に置き換えます。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.