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

# Create an Anthropic message

> Generate a response using the Anthropic Messages format

Include `x-api-key: API_KEY`, `anthropic-version: 2023-06-01`, and `Content-Type: application/json`.

| Field                              | Type         | Required | Description                                              |
| ---------------------------------- | ------------ | -------- | -------------------------------------------------------- |
| `model`                            | string       | Yes      | Model ID.                                                |
| `messages`                         | array        | Yes      | User and assistant messages with text or content blocks. |
| `max_tokens`                       | integer      | Yes      | Maximum generated tokens.                                |
| `system`                           | string/array | No       | System instruction.                                      |
| `stream`                           | boolean      | No       | Return SSE events.                                       |
| `temperature`, `top_p`, `top_k`    | number       | No       | Sampling controls.                                       |
| `stop_sequences`                   | array        | No       | Custom stop sequences.                                   |
| `tools`, `tool_choice`, `metadata` | mixed        | No       | Tools, selection policy, and request metadata.           |

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.bianxie.ai/v1/messages \
    -H "x-api-key: API_KEY" \
    -H "anthropic-version: 2023-06-01" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "your-model",
      "max_tokens": 1024,
      "messages": [{"role": "user", "content": "Hello"}]
    }'
  ```

  ```python Python theme={null}
  client.messages.create(model="your-model", max_tokens=1024, messages=[{"role":"user","content":"Hello"}])
  ```

  ```javascript Node.js theme={null}
  await client.messages.create({ model: "your-model", max_tokens: 1024, messages: [{ role: "user", content: "Hello" }] });
  ```
</CodeGroup>

The response has `id`, `type`, `role`, `content[]`, `model`, `stop_reason`, `stop_sequence`, and `usage`. Streaming returns message, content-block, and ping events.
