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

# Claude Messages API for AI Chat and Text Generation

> POST /gw_llm_power/v1/messages — Send messages using the Anthropic Claude protocol. Supports Claude and GPT models with native Claude request format.

The Claude Messages API lets you interact with Claude and GPT models using the native Anthropic request format. It is fully compatible with the official Anthropic SDK and documentation, so you can point your existing Anthropic integrations at GlobalAI OPC with minimal changes.

**Base URL:** `http://apillm.globalaiopc.com/gw_llm_power`

**Endpoint:** `POST /v1/messages`

## Authentication

Authenticate every request using the `Authorization` header with your API key:

```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## Supported Models

### Claude Models

| Standard            | `-official`                  | `-hc`                  | `-fd`                  |
| ------------------- | ---------------------------- | ---------------------- | ---------------------- |
| `claude-haiku-4-5`  | `claude-haiku-4-5-official`  | `claude-haiku-4-5-hc`  | `claude-haiku-4-5-fd`  |
| `claude-opus-4-5`   | `claude-opus-4-5-official`   | `claude-opus-4-5-hc`   | `claude-opus-4-5-fd`   |
| `claude-opus-4-6`   | `claude-opus-4-6-official`   | `claude-opus-4-6-hc`   | `claude-opus-4-6-fd`   |
| `claude-opus-4-7`   | `claude-opus-4-7-official`   | `claude-opus-4-7-hc`   | `claude-opus-4-7-fd`   |
| `claude-sonnet-4-5` | `claude-sonnet-4-5-official` | `claude-sonnet-4-5-hc` | `claude-sonnet-4-5-fd` |
| `claude-sonnet-4-6` | `claude-sonnet-4-6-official` | `claude-sonnet-4-6-hc` | `claude-sonnet-4-6-fd` |

### GPT Models (via Claude Protocol)

GPT models are also accessible through the Claude Messages API using the same request format.

| Standard  | `-official`        | `-hc`        | `-fd`        | `-low`        |
| --------- | ------------------ | ------------ | ------------ | ------------- |
| `gpt-5.4` | `gpt-5.4-official` | `gpt-5.4-hc` | `gpt-5.4-fd` | `gpt-5.4-low` |
| `gpt-5.5` | `gpt-5.5-official` | `gpt-5.5-hc` | `gpt-5.5-fd` | `gpt-5.5-low` |

<Note>
  GPT models accessed through this endpoint do **not** support image analysis. For image input with GPT models, use the [OpenAI Chat API](/api-reference/text/openai-chat) endpoint instead.
</Note>

### Model Suffix Reference

| Suffix      | Description                                     |
| ----------- | ----------------------------------------------- |
| *(none)*    | Standard version                                |
| `-official` | Official version                                |
| `-hc`       | High-quality pool (AWS or premium account pool) |
| `-fd`       | Proxy pool / mixed account pool                 |
| `-low`      | Budget version                                  |

## Request Parameters

<ParamField body="model" type="string" required>
  The name of the model to use. For example: `claude-opus-4-6`, `claude-sonnet-4-5`, or `gpt-5.5`.
</ParamField>

<ParamField body="max_tokens" type="integer" required>
  The maximum number of tokens the model may generate in its response. This field is required by the Claude protocol.
</ParamField>

<ParamField body="messages" type="array" required>
  An array of message objects representing the conversation history, following the Claude Messages protocol.
</ParamField>

<ParamField body="messages[].role" type="string" required>
  The role of the message author. Accepted values: `user` or `assistant`.
</ParamField>

<ParamField body="messages[].content" type="string | array" required>
  The content of the message. Pass a plain text string for standard text input, or a Claude native content block array for multimodal input.
</ParamField>

<ParamField body="system" type="string">
  An optional system prompt that sets the context and behavior for the model throughout the conversation.
</ParamField>

<ParamField body="stream" type="boolean">
  When set to `true`, the response is returned as a stream of Claude-style SSE events.
</ParamField>

<ParamField body="temperature" type="number">
  Controls the randomness of the model's output. Lower values produce more focused, deterministic responses; higher values produce more varied output.
</ParamField>

## Response Fields

<ResponseField name="id" type="string">
  A unique identifier for the message response.
</ResponseField>

<ResponseField name="type" type="string">
  The type of the returned object. Always `message`.
</ResponseField>

<ResponseField name="role" type="string">
  The role of the generated message. Always `assistant`.
</ResponseField>

<ResponseField name="content[].type" type="string">
  The type of the content block. Typically `text` for standard text responses.
</ResponseField>

<ResponseField name="content[].text" type="string">
  The text content generated by the model.
</ResponseField>

<ResponseField name="stop_reason" type="string">
  The reason the model stopped generating. Common values include `end_turn` (natural end) and `max_tokens` (token limit reached).
</ResponseField>

<ResponseField name="usage.input_tokens" type="integer">
  The number of tokens in the input messages and system prompt.
</ResponseField>

<ResponseField name="usage.output_tokens" type="integer">
  The number of tokens in the generated response.
</ResponseField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST http://apillm.globalaiopc.com/gw_llm_power/v1/messages \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "claude-opus-4-6",
      "max_tokens": 1024,
      "system": "You are a professional writing assistant.",
      "messages": [
        {"role": "user", "content": "Write a product description for a coffee maker."}
      ]
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "http://apillm.globalaiopc.com/gw_llm_power/v1/messages",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "model": "claude-opus-4-6",
          "max_tokens": 1024,
          "system": "You are a professional writing assistant.",
          "messages": [
              {"role": "user", "content": "Write a product description for a coffee maker."}
          ]
      }
  )
  print(response.json()["content"][0]["text"])
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "id": "msg_01ABC123",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Introducing the BrewMaster Pro — your perfect morning companion. With precision temperature control and a 12-cup capacity, it delivers rich, barista-quality coffee every time."
    }
  ],
  "model": "claude-opus-4-6",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 18,
    "output_tokens": 42
  }
}
```

<Note>
  This endpoint is fully compatible with the Anthropic Messages API protocol. For complete details on request options — including extended thinking, tool use, and vision — refer to the [Anthropic Messages API documentation](https://docs.anthropic.com/en/api/messages).
</Note>
