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

# Muse Messages

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

Call Muse Wonder in the Anthropic Messages format with a BeatAPI key.- One endpoint, `POST /v1/messages`, for Muse Wonder.
- Streaming and tool use, with a 1M-token context window.
- Works with the Anthropic SDK: change the base URL and use a BeatAPI key. Send the `anthropic-version` header with every request.
- `tool_choice` is passed to the model, though not every model enforces it; `thinking` does not take effect. See the parameter reference below.Use `https://direct.beatapi.io` as the base URL for text requests: it is not subject to Cloudflare's 100-second limit, so a long non-streaming request is not cut off. `https://api.beatapi.io` also works and is the fallback if `direct.beatapi.io` is unreachable from your network. The key, models and prices are the same on both. Image and video APIs use `https://api.beatapi.io` only.POST/v1/messagesTry itOpens this endpoint in the API Explorer. Enter your BeatAPI API key and send: the call is real and is billed to your own balance.## ModelsSend this ID as `model`.| Model ID      | Context (tokens) | Max output (tokens) | Positioning                                                                                      | Input, USD per 1M tokens | Output, USD per 1M tokens | Notes                                                                                                       |
| ------------- | ---------------- | ------------------- | ------------------------------------------------------------------------------------------------ | ------------------------ | ------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `muse-wonder` | 1,048,576        | 131,072             | Meta Muse Wonder: a frontier reasoning model for complex personal and professional agentic work. | \$4.00                   | \$20.00                   | Meta's frontier reasoning model for complex personal and professional agentic work. Needs a funded account. |- Prices are the base tier, discount already applied. A long-context tier, cached-input rates and cache writes are not in this table; see the [price table](https://beatapi.io/pricing).
- `—` means the catalogue does not publish the number.## Quick startInstall the `@anthropic-ai/sdk` or `anthropic` package on your server, keep the key in `BEATAPI_API_KEY`, and never put it in browser code. The SDK sends the `anthropic-version` header for you. These are request examples, not recorded model outputs.Read the answer from the `text` blocks of `content`, then check `stop_reason` and `usage`. An HTTP 200 alone does not prove the answer satisfies your task: validate it in your application. Text requests return directly; do not poll `/v1/tasks` for them.```bash title="cURL"
curl --request POST \
  --url https://direct.beatapi.io/v1/messages \
  --header "x-api-key: $BEATAPI_API_KEY" \
  --header 'anthropic-version: 2023-06-01' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "muse-wonder",
  "max_tokens": 2000,
  "messages": [
    {
      "role": "user",
      "content": "Design a resilient webhook retry strategy for a payments API."
    }
  ]
}'
``````python title="Python"
import os
from anthropic import Anthropic

client = Anthropic(api_key=os.environ["BEATAPI_API_KEY"], base_url="https://direct.beatapi.io")
message = client.messages.create(
    model="muse-wonder",
    max_tokens=2000,
    messages=[
      {
        "role": "user",
        "content": "Design a resilient webhook retry strategy for a payments API."
      }
    ],
)
print(message.content[0].text)
``````javascript title="JavaScript"
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ apiKey: process.env.BEATAPI_API_KEY, baseURL: "https://direct.beatapi.io" });
const message = await client.messages.create({
  "model": "muse-wonder",
  "max_tokens": 2000,
  "messages": [
    {
      "role": "user",
      "content": "Design a resilient webhook retry strategy for a payments API."
    }
  ]
});
console.log(message.content[0].text);
```## Endpoint and authentication`POST https://direct.beatapi.io/v1/messages`x-api-key
string
RequiredYour BeatAPI key. `Authorization: Bearer <BEATAPI_API_KEY>` is also accepted.Send the `anthropic-version` header (for example `2023-06-01`) with every request; the Anthropic SDK adds it automatically. For authentication, `x-api-key` and `Authorization: Bearer <BEATAPI_API_KEY>` both work.## Request parametersThe request uses the Anthropic Messages shape. The fields below take effect; the last two are accepted by the SDK but do not change the result. A field that is not listed on this page is not guaranteed to have any effect.model
string
RequiredThe exact model ID.**Allowed values**: `muse-wonder`- Each ID is a separate model, not an alias of another.
- Call `GET /v1/models` with your key to confirm which models are enabled for it.max_tokens
integer
RequiredUpper bound on the generated tokens, reasoning included.- The gateway does not compare your value with the model's max output from the table above. Keep it at or below that number.
- `max_tokens` is also used to estimate how much balance a request needs. A very large value can be refused with `402 insufficient_credits` even when the real output would be small. Set it to what you need.A reasoning model writes its reasoning first. If `max_tokens` is too small, the reasoning can use all of it: the `text` block is empty and `stop_reason` is `max_tokens`. Leave room for both, and raise the value when you see `max_tokens`.messages
object[]
RequiredThe conversation, oldest message first. Each message has a `role` (`user` or `assistant`) and `content`: a string, or an array of blocks.- Text blocks (`text`), the model’s tool requests (`tool_use`) and your results (`tool_result`) take effect.
- A `tool_result` block must carry the `tool_use_id` of the `tool_use` block it answers.system
string | object[]
OptionalThe system prompt: a string, or an array of text blocks. The text blocks are joined into one system prompt.stream
boolean
OptionalDefault: falseReturn the answer as server-sent events. See the Streaming section below.**Default**: `false`temperature
number
OptionalSampling temperature. Change this or `top_p`, not both.top_p
number
OptionalNucleus sampling threshold.stop_sequences
string[]
OptionalSequences at which generation stops.tools
object[]
OptionalTool definitions the model may call. Each tool takes effect through its `name`, `description` and `input_schema`. The model answers with a `tool_use` block; return the result in a `tool_result` block of the next `user` message.tool_choice
object
OptionalHow the model may use `tools`. `{"type": "auto"}` lets it decide (the default), `{"type": "any"}` makes it call one of the tools, `{"type": "tool", "name": "..."}` makes it call that tool, and `{"type": "none"}` stops it from calling any. `disable_parallel_tool_use: true` limits it to one call per answer. Ignored when `tools` is absent. The setting is passed to the model, but not every model enforces it: in our tests (2026-10-15) DeepSeek ignored it and Qwen enforced `any` but not a named tool, so check the answer for a `tool_use` block rather than assuming one.thinking
object
OptionalDoes not take effect. It neither turns reasoning on nor off, and it sets no reasoning budget. A model that reasons by default keeps doing so, and its reasoning comes back as `thinking` blocks.## ResponseA non-streaming call returns one JSON object. This is an abbreviated example.```json
{
  "id": "msg_example",
  "type": "message",
  "role": "assistant",
  "model": "muse-wonder",
  "content": [
    {
      "type": "text",
      "text": "Retry with exponential backoff and jitter, and make every handler idempotent."
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 19,
    "output_tokens": 16
  }
}
```### Response fields| Field            | Type       | Description                                                                                                                                                |
| ---------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`             | `string`   | The message ID. Log it, together with the request ID, for support and billing audits.                                                                      |
| `model`          | `string`   | The model that answered.                                                                                                                                   |
| `content[]`      | `object[]` | Content blocks: `thinking` (on models that reason, before the answer), `text` and `tool_use`.                                                              |
| `content[].text` | `string`   | The answer text of a `text` block.                                                                                                                         |
| `stop_reason`    | `string`   | `end_turn` for a complete answer, `tool_use` for a tool request, `max_tokens` when `max_tokens` was reached, `stop_sequence` when a stop sequence matched. |
| `usage`          | `object`   | `input_tokens` and `output_tokens`. Reasoning counts as output. Calls are metered from actual token usage.                                                 |## StreamingSet `"stream": true`. The stream starts with `message_start` and ends with `message_stop`; the blocks in between arrive as `content_block_start`, `content_block_delta` and `content_block_stop` events, and `message_delta` carries the `stop_reason`.- The response is `text/event-stream`; without streaming it is `application/json`.
- Text arrives in `text_delta` events. A reasoning model sends a `thinking` block with `thinking_delta` events before the text block. Tool arguments arrive in `input_json_delta` events.
- A failure before the model is called is returned as a normal JSON error with an HTTP status, not as a stream event.
- Set explicit timeouts and reconnect a streamed response safely.```text
event: message_start
data: {"type":"message_start","message":{"id":"msg_example","type":"message","role":"assistant","content":[],"usage":{"input_tokens":19,"output_tokens":1}}}

event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}

event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Retry"}}

event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" with backoff"}}

event: content_block_stop
data: {"type":"content_block_stop","index":0}

event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":16}}

event: message_stop
data: {"type":"message_stop"}
```## Errors| Error or symptom                                            | Cause                                                                                                         | Fix                                                                     |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| The `text` block is empty and `stop_reason` is `max_tokens` | A reasoning model used the whole `max_tokens` budget on reasoning.                                            | Raise `max_tokens`, within the model max output.                        |
| `402 insufficient_credits`                                  | Balance below the price of the request, often because `max_tokens` is very large.                             | Top up, or lower `max_tokens`.                                          |
| `403 forbidden`                                             | The account is on free credit and the model is not on the free list, or the model is outside the key's group. | Top up, use a free model, or use a key whose group can reach the model. |
| `404 not_found`                                             | Unknown model ID, or not enabled for this key.                                                                | List the enabled models with `GET /v1/models`.                          |
| `429 rate_limit_exceeded`                                   | Account or free-model limit reached.                                                                          | Wait `Retry-After`, then retry.                                         |### HTTP errors at a glanceAuthentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).| HTTP status | Code                                                       | What to do                                                                                   |
| ----------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| 400         | `bad_request`, `content_policy_violation`                  | Fix the request or the input; do not resend it unchanged.                                    |
| 401         | `missing_api_key`, `invalid_api_key`                       | Check the key. Do not retry.                                                                 |
| 402         | `insufficient_credits`                                     | Top up, or raise the key's limit. A very large `max_tokens` can trigger it.                  |
| 403         | `forbidden`                                                | The model is outside the key's group or IP allowlist, or free credit cannot call this model. |
| 404         | `not_found`                                                | Unknown model: list the enabled ones with `GET /v1/models`.                                  |
| 429         | `rate_limit_exceeded`                                      | Wait `Retry-After` or `retry_after_seconds`, then retry with backoff.                        |
| 500         | `internal_error`, `temporary_error`                        | Retry once or twice with backoff.                                                            |
| 503         | `model_unavailable`, `upstream_timeout`, `temporary_error` | Retry with backoff, or use another model.                                                    |Full code table and retry policy: [Errors](/errors#text-endpoints).## Notes- Muse also answers on [Chat Completions](/text-api/muse/chat-completions) and [OpenAI Responses](/text-api/muse/responses).
- `muse-wonder` requires a funded account. An account that only holds free credit cannot call it.
- Muse Wonder reasons before it answers. Reasoning counts as output tokens and is billed as output.
- Send `anthropic-version` with every request. Do not rely on `thinking`: it does not take effect.
- Keep API keys on trusted servers, log the response request ID, and retry only `429`, `500` and `503`.

Reference: https://docs.beatapi.io/api-reference/text-api/muse-messages

## 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) — The exact model ID. Each ID is a separate model, not an alias of another. Call `GET /v1/models` with your key to confirm which models are enabled for it. `muse-wonder`
  - Allowed values: `muse-wonder`
- `max_tokens` (integer, required) — Upper bound on the generated tokens, reasoning included. The gateway does not compare your value with the model's max output from the table above. Keep it at or below that number. `max_tokens` is also used to estimate how much balance a request needs. A very large value can be refused with `402 insufficient_credits` even when the real output would be small. Set it to what you need. A reasoning model writes its reasoning first. If `max_tokens` is too small, the reasoning can use all of it: the `text` block is empty and `stop_reason` is `max_tokens`. Leave room for both, and raise the value when you see `max_tokens`.
- `messages` (list of V1MessagesPostRequestBodyContentApplicationJsonSchemaMessagesItems, required) — The conversation, oldest message first. Each message has a `role` (`user` or `assistant`) and `content`: a string, or an array of blocks. Text blocks (`text`), the model’s tool requests (`tool_use`) and your results (`tool_result`) take effect. A `tool_result` block must carry the `tool_use_id` of the `tool_use` block it answers.
- `system` (V1MessagesPostRequestBodyContentApplicationJsonSchemaSystem, optional) — The system prompt: a string, or an array of text blocks. The text blocks are joined into one system prompt.
- `stream` (boolean, optional, default: false) — Return the answer as server-sent events. See the Streaming section below.
- `temperature` (double, optional) — Sampling temperature. Change this or `top_p`, not both.
- `top_p` (double, optional) — Nucleus sampling threshold.
- `stop_sequences` (list of string, optional) — Sequences at which generation stops.
- `tools` (list of V1MessagesPostRequestBodyContentApplicationJsonSchemaToolsItems, optional) — Tool definitions the model may call. Each tool takes effect through its `name`, `description` and `input_schema`. The model answers with a `tool_use` block; return the result in a `tool_result` block of the next `user` message.
- `tool_choice` (V1MessagesPostRequestBodyContentApplicationJsonSchemaToolChoice, optional) — How the model may use `tools`. `{"type": "auto"}` lets it decide (the default), `{"type": "any"}` makes it call one of the tools, `{"type": "tool", "name": "..."}` makes it call that tool, and `{"type": "none"}` stops it from calling any. `disable_parallel_tool_use: true` limits it to one call per answer. Ignored when `tools` is absent. The setting is passed to the model, but not every model enforces it: in our tests (2026-10-15) DeepSeek ignored it and Qwen enforced `any` but not a named tool, so check the answer for a `tool_use` block rather than assuming one.
- `thinking` (V1MessagesPostRequestBodyContentApplicationJsonSchemaThinking, optional) — Does not take effect. It neither turns reasoning on nor off, and it sets no reasoning budget. A model that reasons by default keeps doing so, and its reasoning comes back as `thinking` blocks.

## Response

### 200

A non-streaming call returns one JSON object. This is an abbreviated example.

- `id` (string, optional) — The message ID. Log it, together with the request ID, for support and billing audits.
- `model` (string, optional) — The model that answered.
- `content` (list of V1MessagesPostResponsesContentApplicationJsonSchemaContentItems, optional) — Content blocks: `thinking` (on models that reason, before the answer), `text` and `tool_use`.
- `stop_reason` (string, optional) — `end_turn` for a complete answer, `tool_use` for a tool request, `max_tokens` when `max_tokens` was reached, `stop_sequence` when a stop sequence matched.
- `usage` (V1MessagesPostResponsesContentApplicationJsonSchemaUsage, optional) — `input_tokens` and `output_tokens`. Reasoning counts as output. Calls are metered from actual token usage.

## Errors

### 400 Bad Request Error

`bad_request`, `content_policy_violation` Fix the request or the input; do not resend it unchanged. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

### 401 Unauthorized Error

`missing_api_key`, `invalid_api_key` Check the key. Do not retry. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

### 402 Payment Required Error

`insufficient_credits` Top up, or raise the key's limit. A very large `max_tokens` can trigger it. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

### 403 Forbidden Error

`forbidden` The model is outside the key's group or IP allowlist, or free credit cannot call this model. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

### 404 Not Found Error

`not_found` Unknown model: list the enabled ones with `GET /v1/models`. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

### 429 Too Many Requests Error

`rate_limit_exceeded` Wait `Retry-After` or `retry_after_seconds`, then retry with backoff. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

### 500 Internal Server Error

`internal_error`, `temporary_error` Retry once or twice with backoff. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

### 503 Service Unavailable Error

`model_unavailable`, `upstream_timeout`, `temporary_error` Retry with backoff, or use another model. Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: `error.code`, `error.message`, `retryable`, `request_id`. Every other failure keeps the Anthropic shape `{"type": "error", "error": {"type", "message"}}`: the code is in `error.type` and the request id ends `message`. See [Errors](/errors#text-endpoints).

- `map from string to any`

## Types

### V1MessagesPostRequestBodyContentApplicationJsonSchemaMessagesItems

- `role` (string, required)
- `content` (V1MessagesPostRequestBodyContentApplicationJsonSchemaMessagesItemsContent, required)

### V1MessagesPostRequestBodyContentApplicationJsonSchemaSystem

The system prompt: a string, or an array of text blocks. The text blocks are joined into one system prompt.

### V1MessagesPostRequestBodyContentApplicationJsonSchemaToolsItems

### V1MessagesPostRequestBodyContentApplicationJsonSchemaToolChoice

How the model may use `tools`. `{"type": "auto"}` lets it decide (the default), `{"type": "any"}` makes it call one of the tools, `{"type": "tool", "name": "..."}` makes it call that tool, and `{"type": "none"}` stops it from calling any. `disable_parallel_tool_use: true` limits it to one call per answer. Ignored when `tools` is absent. The setting is passed to the model, but not every model enforces it: in our tests (2026-10-15) DeepSeek ignored it and Qwen enforced `any` but not a named tool, so check the answer for a `tool_use` block rather than assuming one.

### V1MessagesPostRequestBodyContentApplicationJsonSchemaThinking

Does not take effect. It neither turns reasoning on nor off, and it sets no reasoning budget. A model that reasons by default keeps doing so, and its reasoning comes back as `thinking` blocks.

### V1MessagesPostResponsesContentApplicationJsonSchemaContentItems

- `text` (string, optional) — The answer text of a `text` block.

### V1MessagesPostResponsesContentApplicationJsonSchemaUsage

`input_tokens` and `output_tokens`. Reasoning counts as output. Calls are metered from actual token usage.

### V1MessagesPostRequestBodyContentApplicationJsonSchemaMessagesItemsContent

## Examples

**Request**

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

**Response**

```json
{
  "id": "msg_example",
  "model": "muse-wonder",
  "content": [
    {
      "text": "Retry with exponential backoff and jitter, and make every handler idempotent.",
      "type": "text"
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 19,
    "output_tokens": 16
  },
  "role": "assistant",
  "stop_sequence": null,
  "type": "message"
}
```

**SDK Code**

```python Quick start
import requests

url = "https://direct.beatapi.io/v1/messages"

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

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

print(response.json())
```

```javascript Quick start
const url = 'https://direct.beatapi.io/v1/messages';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"muse-wonder","max_tokens":2000,"messages":[{"role":"user","content":"Design a resilient webhook retry strategy for a payments API."}]}'
};

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

```go Quick start
package main

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

func main() {

	url := "https://direct.beatapi.io/v1/messages"

	payload := strings.NewReader("{\n  \"model\": \"muse-wonder\",\n  \"max_tokens\": 2000,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Design a resilient webhook retry strategy for a payments API.\"\n    }\n  ]\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 Quick start
require 'uri'
require 'net/http'

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

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\": \"muse-wonder\",\n  \"max_tokens\": 2000,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Design a resilient webhook retry strategy for a payments API.\"\n    }\n  ]\n}"

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

```java Quick start
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Quick start
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Quick start
using RestSharp;

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

```swift Quick start
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://direct.beatapi.io/v1/messages")! 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()
```