---
title: "Anthropic messages, governed and recorded"
method: POST
path: "/v1/messages"
tags: ["proxy"]
---

# Anthropic messages, governed and recorded

`POST /v1/messages`

## Request

- Base URL: `https://www.spendline.ai`
- URL: `https://www.spendline.ai/v1/messages`
- Auth: API key in header `x-spendline-key`

Set the Anthropic SDK baseURL to https://www.spendline.ai. WITHOUT /v1. The Anthropic SDK appends /v1/messages itself. This asymmetry with the OpenAI SDK is real; do not "fix" it.

Streaming is supported.

## Headers

- `x-api-key` string, required
- `anthropic-version` string, required
- `x-agent-id` string
- `x-customer-id` string
- `x-spendline-tags` string
- `x-workflow-id` string
- `x-step-name` string
- `x-source-route` string

## Request body

- object
  - `model` string, required
  - `max_tokens` integer, required
  - `messages` object[], required
  - `stream` boolean

## Response `200`

Anthropic response, passed through unchanged. The call is recorded.

## Other responses

- `400`: missing_required_attribution, a required attribution header is absent while enforcement is on.
- `401`: The Spendline key is missing or invalid. Do NOT fall back to the provider.
- `402`: A budget blocked this call BEFORE any spend occurred. Intended behaviour. Surface it; never retry against the provider directly.
- `403`: A policy or governance rule blocked the call. Never route around it.
- `429`: Rate limited. Back off and retry.
- `502`: Upstream provider error, or Spendline could not reach it. This is the only class of failure where retrying directly against the provider is correct.

---

[API](https://skmtc.dev/spendline/apis/spendline-api.md) · [All operations](https://skmtc.dev/spendline/apis/spendline-api/llms.txt) · [OpenAPI document](https://skmtc.dev/spendline/apis/spendline-api/revisions/eb22b9415a28?raw)
