# All OpenAI-format LLM Models Support the Official Claude Format

YutoAPI OpenAI-format LLM models can also be called through the Anthropic Messages endpoint. If your application, SDK, or proxy layer already sends Claude-style message payloads, point it to YutoAPI `POST /v1/messages` and keep using your YutoAPI Base URL and API key.

## When to Use It

- You are migrating from Claude / Anthropic Messages API to YutoAPI.
- Your toolchain only supports Anthropic-style `messages` payloads.
- You want to use both OpenAI-compatible endpoints and Claude-format endpoints under the same YutoAPI account.

## How to Call It

1. Get your Base URL and API key from the console. See [Get Base URL and API Key](/en/api/doc-6535931).
2. Set the request URL to `{BaseURL}/v1/messages`.
3. Use `Authorization: Bearer YOUR_API_KEY`.
4. Send `model`, `max_tokens`, `messages`, and related fields in Anthropic Messages format.

Minimal request example:

```bash
curl --location --request POST '{BaseURL}/v1/messages' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "model": "claude-3-5-sonnet-20240620",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Explain how to integrate the YutoAPI Anthropic Messages endpoint in three sentences."
          }
        ]
      }
    ]
  }'
```

If your Anthropic SDK or gateway requires the official version header, you can keep:

```text
anthropic-version: 2023-06-01
```

YutoAPI authentication still uses `Authorization: Bearer YOUR_API_KEY`.

## Difference from OpenAI Chat Completions

| Item | OpenAI-compatible format | Claude official format |
| --- | --- | --- |
| Endpoint | `/v1/chat/completions` | `/v1/messages` |
| Message body | `messages[].content` is usually a string or multimodal array | `messages[].content` uses Anthropic content block arrays |
| Maximum output | Usually `max_tokens` | `max_tokens` |
| Model field | `model` | `model` |

If your OpenAI-compatible integration already works, you do not need to migrate. Use `/v1/messages` when your SDK, upstream tool, or business code depends on Anthropic Messages payloads.

## JavaScript Example

```js
const response = await fetch(`${baseUrl}/v1/messages`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "claude-3-5-sonnet-20240620",
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "text",
            text: "Summarize the integration flow for this endpoint."
          }
        ]
      }
    ]
  })
});

const data = await response.json();
console.log(data);
```

## Notes

- Do not put API keys in public frontend code, GitHub, logs, or screenshots.
- `model` must be a model available to your account. You can check models through [List Models](/en/api/api-287780941).
- Multimodal image requests also use `/v1/messages`; see [Messages - Vision](/en/api/api-266125082) for an image payload example.
- Endpoint parameter reference: [Messages - Official Anthropic Format](/en/api/api-228980408).
