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

# Create a Message

Creates a message. Pass `stream: true` to stream the message as server-sent events.

```py Python theme={null}
from anthropic import Anthropic
import os

# 💥 Create an Anthropic client, pointed at Muna
anthropic = Anthropic(
  api_key=os.environ["MUNA_API_KEY"],
  base_url="https://inference.muna.ai"
)

# 🔥 Create a message
message = anthropic.messages.create(
  model="@qwen/qwen-3.8-27b",
  max_tokens=1024,
  messages=[{ "role": "user", "content": "What is the capital of France?" }]
)

# 🚀 Print the result
print(message.content[0].text)
```

```ts JavaScript theme={null}
import Anthropic from "@anthropic-ai/sdk"

// 💥 Create an Anthropic client, pointed at Muna
const anthropic = new Anthropic({
  apiKey: process.env.MUNA_API_KEY,
  baseURL: "https://inference.muna.ai"
});

// 🔥 Create a message
const message = await anthropic.messages.create({
  model: "@qwen/qwen-3.8-27b",
  max_tokens: 1024,
  messages: [{ role: "user", content: "What is the capital of France?" }]
});

// 🚀 Print the result
console.log(message.content[0].text);
```

```py Python (streaming) theme={null}
# 🔥 Stream a message
with anthropic.messages.stream(
  model="@qwen/qwen-3.8-27b",
  max_tokens=1024,
  messages=[{ "role": "user", "content": "What is life?" }]
) as stream:
  # 🚀 Use text deltas
  for text in stream.text_stream:
    ...
```

```bash curl theme={null}
curl https://inference.muna.ai/v1/messages \
  -H "x-api-key: $MUNA_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "@qwen/qwen-3.8-27b",
    "max_tokens": 1024,
    "messages": [{ "role": "user", "content": "What is the capital of France?" }]
  }'
```

```json Response theme={null}
{
  "id": "msg_6f1c2b9e4d3a4b8e9c1f2a7d",
  "type": "message",
  "role": "assistant",
  "model": "@qwen/qwen-3.8-27b",
  "content": [
    { "type": "text", "text": "The capital of France is Paris." }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 16,
    "output_tokens": 8,
    "cache_read_input_tokens": 0
  }
}
```

### Body

**model** `string` *required*

Model tag.

**max\_tokens** `integer` *required*

Maximum number of tokens to generate.

**messages** `MessageParam[]` *required*

Input messages. Content blocks can be `text`, `image`, `tool_use`, or `tool_result`.

**system** `string | TextBlock[]`

System prompt.

**stream** `boolean`

Whether to stream the message as server-sent events. Defaults to `false`.

**tools** `Tool[]`

Tools the model may call.

**thinking** `ThinkingConfig`

Extended thinking configuration: `{ "type": "disabled" }`, `{ "type": "enabled", "budget_tokens": N }`,
or `{ "type": "adaptive" }`. Mapped onto the model's reasoning effort.

**output\_config.effort** `string`

Reasoning effort: `low`, `medium`, `high`, `xhigh`, or `max`.

**temperature** `number`

Sampling temperature.

**top\_p** `number`

Nucleus sampling coefficient.

**top\_k** `integer`

Only sample from the top K options for each token. Ignored by models that do not support it.

**stop\_sequences** `string[]`

Custom text sequences that stop generation. Ignored by models that do not support it.

### Response

**id** `string` *required*

Message identifier.

**type** `string` *required*

Object type, always `message`.

**role** `string` *required*

Message role, always `assistant`.

**model** `string` *required*

Model tag.

**content** `ContentBlock[]` *required*

Generated content. Blocks can be `text`, `thinking`, or `tool_use`.

**stop\_reason** `string`

Reason the model stopped generating: `end_turn`, `max_tokens`, `stop_sequence`, or `tool_use`.

**stop\_sequence** `string`

Custom stop sequence that was generated, if any.

**usage** `Usage` *required*

Token usage.

**properties**

**input\_tokens** `integer`

Number of input tokens, excluding cached tokens.

**output\_tokens** `integer` *required*

Number of output tokens.

**cache\_read\_input\_tokens** `integer`

Number of input tokens served from cache, billed at the cached input rate.

**cache\_creation\_input\_tokens** `integer`

Number of input tokens written to cache.


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