> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# MiMo Chat Completions

POST https://direct.beatapi.io/v1/chat/completions
Content-Type: application/json

1 つの BeatAPI キーで、同じ OpenAI Chat Completions エンドポイントから MiMo V2.6 Flash と V2.5 を呼び出せます。- 1 つのエンドポイント `POST /v1/chat/completions` で、現行の MiMo モデルすべてを呼び出せます。`model` を変えるだけで切り替わります。
- ストリーミングと関数呼び出しに対応し、どちらのモデルも 100 万トークンのコンテキストウィンドウを備えています。
- OpenAI SDK で使えます。base URL を変え、BeatAPI のキーを使うだけです。
- 同じモデルは [OpenAI Responses](/text-api/mimo/responses) と [Anthropic Messages](/text-api/mimo/messages) でも呼び出せます。テキストリクエストの base URL には `https://direct.beatapi.io` を推奨します。Cloudflare の 100 秒制限を受けないため、長時間のノンストリーミングリクエストが途中で切れません。`https://api.beatapi.io` も使え、ネットワークから `direct.beatapi.io` に届かない場合の代替になります。キー、モデル、価格はどちらも同じです。画像・動画 API は `https://api.beatapi.io` のみを使います。POST/v1/chat/completions試してみるこのエンドポイントをテスト画面で開きます。BeatAPI の API キーを入力して送信してください。実際に呼び出され、ご自身の残高から課金されます。## モデル次の ID のいずれかを `model` として送ります。それぞれ別のモデルで、互いのエイリアスではありません。| モデル ID            | コンテキスト（トークン） | 最大出力（トークン） | 位置づけ                                                | 入力、USD / 100 万トークン | 出力、USD / 100 万トークン | 備考                                                  |
| ----------------- | ------------ | ---------- | --------------------------------------------------- | ------------------ | ------------------ | --------------------------------------------------- |
| `mimo-v2.6-flash` | 1,048,576    | 128,000    | マルチモーダルなコーディングエージェントと長文コンテキストの自動化向けの MiMo Flash モデル | \$0.098            | \$0.196            | MiMo Flash モデル。マルチモーダルなコーディングエージェントと長文コンテキストの自動化向け。 |
| `mimo-v2.5`       | 1,048,576    | 128,000    | オープンな MiMo モデル。マルチモーダルなコーディングエージェントと長文コンテキストの自動化向け  | \$0.098            | \$0.196            | オープンな MiMo モデル。マルチモーダルなコーディングエージェントと長文コンテキストの自動化向け。 |- 価格は基本ティアで、割引適用後です。長文コンテキストのティア、キャッシュ入力価格、キャッシュ書き込み価格はこの表に含まれません。[価格表](https://beatapi.io/pricing)を参照してください。
- `—` はカタログが数値を公開していないことを示します。## クイックスタートサーバーに `openai` パッケージをインストールし、キーは `BEATAPI_API_KEY` に置いてください。ブラウザのコードには書かないでください。以下はリクエスト例であり、実際のモデル出力の記録ではありません。回答は `choices[0].message.content` から読み取り、続けて `finish_reason` と `usage` を確認します。HTTP 200 だけでは回答がタスクを満たす証拠になりません。内容はアプリケーション側で検証してください。テキストのリクエストは直接結果を返すので、`/v1/tasks` をポーリングする必要はありません。```bash title="cURL"
curl --request POST \
  --url https://direct.beatapi.io/v1/chat/completions \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "mimo-v2.6-flash",
  "max_tokens": 2000,
  "messages": [
    {
      "role": "user",
      "content": "Design a resilient webhook retry strategy for a payments API."
    }
  ]
}'
``````python title="Python"
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["BEATAPI_API_KEY"], base_url="https://direct.beatapi.io/v1")
completion = client.chat.completions.create(
    model="mimo-v2.6-flash",
    max_tokens=2000,
    messages=[
      {
        "role": "user",
        "content": "Design a resilient webhook retry strategy for a payments API."
      }
    ],
)
print(completion.choices[0].message.content)
``````javascript title="JavaScript"
import OpenAI from "openai";

const client = new OpenAI({ apiKey: process.env.BEATAPI_API_KEY, baseURL: "https://direct.beatapi.io/v1" });
const completion = await client.chat.completions.create({
  "model": "mimo-v2.6-flash",
  "max_tokens": 2000,
  "messages": [
    {
      "role": "user",
      "content": "Design a resilient webhook retry strategy for a payments API."
    }
  ]
});
console.log(completion.choices[0].message.content);
```## エンドポイントと認証`POST https://direct.beatapi.io/v1/chat/completions`Authorization
string
必須`Bearer <BEATAPI_API_KEY>`。キーは `sk-` プレフィックスの有無どちらでも使えます。## リクエストパラメーターOpenAI Chat Completions の標準フィールドを受け付けます。リクエスト形式が互換でも、すべてのモデルがあらゆるオプションに対応するわけではありません。依存するオプションは自分で試してください。model
string
必須正確なモデル ID。**指定できる値**：`mimo-v2.6-flash`, `mimo-v2.5`- 各 ID は独立したモデルで、他のモデルの別名ではありません。
- キーで `GET /v1/models` を呼ぶと、そのキーで有効なモデルを確認できます。messages
object[]
必須会話の内容。古いメッセージが先頭です。各メッセージには `role`（`system`、`user`、`assistant`、`tool`）と `content` があります。max_tokens
integer
任意生成するトークン数の上限。推論の分も含みます。- ゲートウェイは、指定値を上の表の最大出力と照合しません。その数値以下に収めてください。
- `max_tokens` は、リクエストに必要な残高の見積もりにも使われます。極端に大きい値だと、実際の出力が短くても `402 insufficient_credits` で拒否されることがあります。必要な分だけ指定してください。推論型モデルは先に推論を出力します。`max_tokens` が小さすぎると推論で使い切られ、`content` が空になって `finish_reason` が `length` になります。推論と本文の両方に余裕を持たせ、`length` が出たら値を増やしてください。stream
boolean
任意デフォルト: false回答をサーバー送信イベント（SSE）として返します。下の「ストリーミング」を参照してください。**デフォルト**：`false`temperature
number
任意サンプリング温度。`top_p` とはどちらか一方だけ調整してください。top_p
number
任意nucleus sampling のしきい値。stop
string | string[]
任意生成を止める文字列を 1 つ以上指定します。tools
object[]
任意モデルが呼び出せる関数の定義。モデルは `tool_calls` で応答します。各結果は、対応する `tool_call_id` を付けた次の `tool` メッセージで返してください。tool_choice
string | object
任意モデルがツールを呼び出してよいか、必ず呼ぶか、呼ばないかを指定します。依存する値は使うモデルで試してください。## レスポンス非ストリーミングの呼び出しは JSON オブジェクトを 1 つ返します。以下は省略した例です。```json
{
  "id": "chatcmpl-example",
  "object": "chat.completion",
  "created": 1791993600,
  "model": "mimo-v2.6-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Retry with exponential backoff and jitter, and make every handler idempotent."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 19,
    "completion_tokens": 16,
    "total_tokens": 35
  }
}
```### レスポンスのフィールド| フィールド                                 | 型          | 説明                                                                          |
| ------------------------------------- | ---------- | --------------------------------------------------------------------------- |
| `id`                                  | `string`   | 補完 ID。サポート対応や請求の照合のため、リクエスト ID と合わせて記録してください。                               |
| `model`                               | `string`   | 実際に回答したモデル。                                                                 |
| `choices[].message.content`           | `string`   | 回答テキスト。                                                                     |
| `choices[].message.reasoning_content` | `string`   | 推論テキスト。推論型モデルのみ返します。出力として課金されます。                                            |
| `choices[].message.tool_calls`        | `object[]` | モデルが実行を求める関数呼び出し。`finish_reason` が `tool_calls` のときに含まれます。                  |
| `choices[].finish_reason`             | `string`   | `stop` は回答が完結、`tool_calls` はツール呼び出しの要求、`length` は `max_tokens` に達したことを示します。 |
| `usage`                               | `object`   | トークン数。呼び出しは実際のトークン使用量で計量されます。                                               |## ストリーミング`"stream": true` を指定します。回答は `chat.completion.chunk` イベントとして順に届き、最後に `data: [DONE]` で終わります。- レスポンスは `text/event-stream` です。ストリーミングしない場合は `application/json` です。
- テキストは `choices[0].delta.content` に入ります。推論型モデルは、先に `delta.reasoning_content` で推論を送ります。
- モデルを呼び出す前に失敗した場合は、ストリームイベントではなく、HTTP ステータス付きの通常の JSON エラーが返ります。
- 明示的なタイムアウトを設定し、ストリーミングの再接続は安全に行ってください。```text
data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"Retry"},"finish_reason":null}]}

data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" with backoff"},"finish_reason":null}]}

data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]
```## エラー| エラーまたは症状                                 | 原因                                                   | 対処                                       |
| ---------------------------------------- | ---------------------------------------------------- | ---------------------------------------- |
| `content` が空で、`finish_reason` が `length` | 推論型モデルが `max_tokens` の枠をすべて推論に使いました。                 | モデルの最大出力の範囲内で `max_tokens` を増やします。       |
| `402 insufficient_credits`               | 残高がリクエストの料金に足りません。`max_tokens` が非常に大きいことが多い原因です。     | チャージするか、`max_tokens` を小さくします。            |
| `403 forbidden`                          | アカウントが無料クレジットのみでそのモデルが無料リストにない、またはモデルがキーのグループの範囲外です。 | チャージする、無料モデルを使う、またはそのモデルに届くグループのキーを使います。 |
| `404 not_found`                          | モデル ID が存在しない、またはこのキーで有効になっていません。                    | `GET /v1/models` で有効なモデルを一覧します。          |
| `429 rate_limit_exceeded`                | アカウントまたは無料モデルの上限に達しました。                              | `Retry-After` の時間だけ待ってから再試行します。          |### HTTP エラー早見表認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。| HTTP ステータス | エラーコード                                                   | 対応                                                             |
| ---------- | -------------------------------------------------------- | -------------------------------------------------------------- |
| 400        | `bad_request`、`content_policy_violation`                 | リクエストか入力を直してください。そのまま再送しないでください。                               |
| 401        | `missing_api_key`、`invalid_api_key`                      | キーを確認してください。再試行しないでください。                                       |
| 402        | `insufficient_credits`                                   | チャージするか、キーの上限を上げてください。`max_tokens` が非常に大きい場合も発生します。            |
| 403        | `forbidden`                                              | モデルがキーのグループまたは IP 許可リストの範囲外、または無料クレジットでは呼べないモデルです。             |
| 404        | `not_found`                                              | モデルが存在しません。`GET /v1/models` で有効なモデルを確認してください。                  |
| 429        | `rate_limit_exceeded`                                    | `Retry-After` または `retry_after_seconds` だけ待ち、バックオフして再試行してください。 |
| 500        | `internal_error`、`temporary_error`                       | バックオフして 1～2 回再試行してください。                                        |
| 503        | `model_unavailable`、`upstream_timeout`、`temporary_error` | バックオフして再試行するか、別のモデルを使ってください。                                   |全エラーコード表と再試行ポリシーは[エラー](/errors#text-endpoints)を参照してください。## 注意事項- MiMo モデルは [OpenAI Responses](/text-api/mimo/responses) と [Anthropic Messages](/text-api/mimo/messages) でも呼び出せます。
- API キーは信頼できるサーバーにだけ置き、レスポンスのリクエスト ID を記録し、再試行は `429`、`500`、`503` に限ってください。

Reference: https://docs.beatapi.io/api-reference/text-api/mimo-chat-completions

## Authentication

- `Authorization` header (bearer token, required) — Send your API key as `Authorization: Bearer <BEATAPI_API_KEY>`.

## Servers

- `https://direct.beatapi.io` (Direct, default)
- `https://api.beatapi.io` (API)

## Request

### Body (application/json)

This endpoint expects an object.

- `model` (enum, required) — 正確なモデル ID。 各 ID は独立したモデルで、他のモデルの別名ではありません。 キーで `GET /v1/models` を呼ぶと、そのキーで有効なモデルを確認できます。 `mimo-v2.6-flash`, `mimo-v2.5`
  - Allowed values: `mimo-v2.6-flash`, `mimo-v2.5`
- `messages` (list of V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaMessagesItems, required) — 会話の内容。古いメッセージが先頭です。各メッセージには `role`（`system`、`user`、`assistant`、`tool`）と `content` があります。
- `max_tokens` (integer, optional) — 生成するトークン数の上限。推論の分も含みます。 ゲートウェイは、指定値を上の表の最大出力と照合しません。その数値以下に収めてください。 `max_tokens` は、リクエストに必要な残高の見積もりにも使われます。極端に大きい値だと、実際の出力が短くても `402 insufficient_credits` で拒否されることがあります。必要な分だけ指定してください。 推論型モデルは先に推論を出力します。`max_tokens` が小さすぎると推論で使い切られ、`content` が空になって `finish_reason` が `length` になります。推論と本文の両方に余裕を持たせ、`length` が出たら値を増やしてください。
- `stream` (boolean, optional, default: false) — 回答をサーバー送信イベント（SSE）として返します。下の「ストリーミング」を参照してください。
- `temperature` (double, optional) — サンプリング温度。`top_p` とはどちらか一方だけ調整してください。
- `top_p` (double, optional) — nucleus sampling のしきい値。
- `stop` (V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaStop, optional) — 生成を止める文字列を 1 つ以上指定します。
- `tools` (list of V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaToolsItems, optional) — モデルが呼び出せる関数の定義。モデルは `tool_calls` で応答します。各結果は、対応する `tool_call_id` を付けた次の `tool` メッセージで返してください。
- `tool_choice` (V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaToolChoice, optional) — モデルがツールを呼び出してよいか、必ず呼ぶか、呼ばないかを指定します。依存する値は使うモデルで試してください。

## Response

### 200

非ストリーミングの呼び出しは JSON オブジェクトを 1 つ返します。以下は省略した例です。

- `id` (string, optional) — 補完 ID。サポート対応や請求の照合のため、リクエスト ID と合わせて記録してください。
- `model` (string, optional) — 実際に回答したモデル。
- `choices` (list of V1ChatCompletionsPostResponsesContentApplicationJsonSchemaChoicesItems, optional)
- `usage` (V1ChatCompletionsPostResponsesContentApplicationJsonSchemaUsage, optional) — トークン数。呼び出しは実際のトークン使用量で計量されます。

## Errors

### 400 Bad Request Error

`bad_request`、`content_policy_violation` リクエストか入力を直してください。そのまま再送しないでください。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

### 401 Unauthorized Error

`missing_api_key`、`invalid_api_key` キーを確認してください。再試行しないでください。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

### 402 Payment Required Error

`insufficient_credits` チャージするか、キーの上限を上げてください。`max_tokens` が非常に大きい場合も発生します。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

### 403 Forbidden Error

`forbidden` モデルがキーのグループまたは IP 許可リストの範囲外、または無料クレジットでは呼べないモデルです。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

### 404 Not Found Error

`not_found` モデルが存在しません。`GET /v1/models` で有効なモデルを確認してください。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

### 429 Too Many Requests Error

`rate_limit_exceeded` `Retry-After` または `retry_after_seconds` だけ待ち、バックオフして再試行してください。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

### 500 Internal Server Error

`internal_error`、`temporary_error` バックオフして 1～2 回再試行してください。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

### 503 Service Unavailable Error

`model_unavailable`、`upstream_timeout`、`temporary_error` バックオフして再試行するか、別のモデルを使ってください。 認証、ルーティング、レート制限、存在しないモデルの失敗はモデルを呼ぶ前に起き、BeatAPI のエンベロープ（`error.code`、`error.message`、`retryable`、`request_id`）で返ります。それ以外の失敗は OpenAI SDK の形式 `{"error": {"message", "type", "code"}}` のままで、コードは `error.code`、request id は `message` の末尾にあります。詳しくは[エラー](/errors#text-endpoints)を参照してください。

- `map from string to any`

## Types

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaMessagesItems

- `role` (string, required)
- `content` (V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaMessagesItemsContent, optional, nullable)
- `name` (string, optional)
- `tool_call_id` (string, optional)
- `tool_calls` (list of V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaMessagesItemsToolCallsItems, optional)

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaStop

生成を止める文字列を 1 つ以上指定します。

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaToolsItems

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaToolChoice

モデルがツールを呼び出してよいか、必ず呼ぶか、呼ばないかを指定します。依存する値は使うモデルで試してください。

### V1ChatCompletionsPostResponsesContentApplicationJsonSchemaChoicesItems

- `message` (V1ChatCompletionsPostResponsesContentApplicationJsonSchemaChoicesItemsMessage, optional)
- `finish_reason` (string, optional) — `stop` は回答が完結、`tool_calls` はツール呼び出しの要求、`length` は `max_tokens` に達したことを示します。

### V1ChatCompletionsPostResponsesContentApplicationJsonSchemaUsage

トークン数。呼び出しは実際のトークン使用量で計量されます。

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaMessagesItemsContent

### V1ChatCompletionsPostRequestBodyContentApplicationJsonSchemaMessagesItemsToolCallsItems

### V1ChatCompletionsPostResponsesContentApplicationJsonSchemaChoicesItemsMessage

- `content` (string, optional) — 回答テキスト。
- `reasoning_content` (string, optional) — 推論テキスト。推論型モデルのみ返します。出力として課金されます。
- `tool_calls` (list of V1ChatCompletionsPostResponsesContentApplicationJsonSchemaChoicesItemsMessageToolCallsItems, optional) — モデルが実行を求める関数呼び出し。`finish_reason` が `tool_calls` のときに含まれます。

### V1ChatCompletionsPostResponsesContentApplicationJsonSchemaChoicesItemsMessageToolCallsItems

## Examples

**Request**

```json
{
  "model": "mimo-v2.6-flash",
  "messages": [
    {
      "role": "user",
      "content": "Design a resilient webhook retry strategy for a payments API."
    }
  ],
  "max_tokens": 2000
}
```

**Response**

```json
{
  "id": "chatcmpl-example",
  "model": "mimo-v2.6-flash",
  "choices": [
    {
      "message": {
        "content": "Retry with exponential backoff and jitter, and make every handler idempotent.",
        "role": "assistant"
      },
      "finish_reason": "stop",
      "index": 0
    }
  ],
  "usage": {
    "completion_tokens": 16,
    "prompt_tokens": 19,
    "total_tokens": 35
  },
  "created": 1791993600,
  "object": "chat.completion"
}
```

**SDK Code**

```python クイックスタート
import requests

url = "https://direct.beatapi.io/v1/chat/completions"

payload = {
    "model": "mimo-v2.6-flash",
    "messages": [
        {
            "role": "user",
            "content": "Design a resilient webhook retry strategy for a payments API."
        }
    ],
    "max_tokens": 2000
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript クイックスタート
const url = 'https://direct.beatapi.io/v1/chat/completions';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"mimo-v2.6-flash","messages":[{"role":"user","content":"Design a resilient webhook retry strategy for a payments API."}],"max_tokens":2000}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go クイックスタート
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://direct.beatapi.io/v1/chat/completions"

	payload := strings.NewReader("{\n  \"model\": \"mimo-v2.6-flash\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Design a resilient webhook retry strategy for a payments API.\"\n    }\n  ],\n  \"max_tokens\": 2000\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby クイックスタート
require 'uri'
require 'net/http'

url = URI("https://direct.beatapi.io/v1/chat/completions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"mimo-v2.6-flash\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Design a resilient webhook retry strategy for a payments API.\"\n    }\n  ],\n  \"max_tokens\": 2000\n}"

response = http.request(request)
puts response.read_body
```

```java クイックスタート
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://direct.beatapi.io/v1/chat/completions")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"mimo-v2.6-flash\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Design a resilient webhook retry strategy for a payments API.\"\n    }\n  ],\n  \"max_tokens\": 2000\n}")
  .asString();
```

```php クイックスタート
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://direct.beatapi.io/v1/chat/completions', [
  'body' => '{
  "model": "mimo-v2.6-flash",
  "messages": [
    {
      "role": "user",
      "content": "Design a resilient webhook retry strategy for a payments API."
    }
  ],
  "max_tokens": 2000
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp クイックスタート
using RestSharp;

var client = new RestClient("https://direct.beatapi.io/v1/chat/completions");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"mimo-v2.6-flash\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Design a resilient webhook retry strategy for a payments API.\"\n    }\n  ],\n  \"max_tokens\": 2000\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift クイックスタート
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "mimo-v2.6-flash",
  "messages": [
    [
      "role": "user",
      "content": "Design a resilient webhook retry strategy for a payments API."
    ]
  ],
  "max_tokens": 2000
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://direct.beatapi.io/v1/chat/completions")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```