# Messages (Anthropic shape)

Source: https://immiscible.fly.dev/docs/api/post-anthropic-v1-messages

`POST /anthropic/v1/messages`

The Anthropic Messages API, governed, for Claude Code and the Anthropic SDKs (`baseURL: https://immiscible.fly.dev/anthropic`). Tool use, prompt caching, extended thinking and streaming pass through untouched. Claude Code's session id becomes the task automatically.

## Authentication

Workspace key. A gateway key (`ask_...`) issued under Keys in the console, sent as `Authorization: Bearer` or `x-api-key`. It binds traffic to a person or service, a team and optionally a task class.

## Request

curl:

```bash
curl -X POST "https://immiscible.fly.dev/anthropic/v1/messages" \
  -H "authorization: Bearer $IMMISCIBLE_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "Summarise this diff."
      }
    ]
  }'
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/anthropic/v1/messages', {
  method: 'POST',
  headers: {
    authorization: `Bearer ${process.env.IMMISCIBLE_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    model: 'claude-sonnet-5',
    max_tokens: 1024,
    messages: [
      {
        role: 'user',
        content: 'Summarise this diff.',
      },
    ],
  }),
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.post(
    "https://immiscible.fly.dev/anthropic/v1/messages",
    headers={
        "authorization": f"Bearer {os.environ['IMMISCIBLE_KEY']}",
        "content-type": "application/json",
    },
    json={
        "model": "claude-sonnet-5",
        "max_tokens": 1024,
        "messages": [
            {
                "role": "user",
                "content": "Summarise this diff.",
            },
        ],
    },
)
print(res.status_code, res.json())
```
