Skip to content
Sign Up Free
API Reference

Anthropic Messages API

Test BetterToken's Anthropic-compatible Messages API: x-api-key, anthropic-version, and POST /v1/messages.

POST /v1/messages

Use this endpoint for Claude Code, the Anthropic SDK, and applications that use the Anthropic Messages API.

Test in the Playground

In the Playground on the right, enter your API Key in the x-api-key field, leave anthropic-version as 2023-06-01, choose a model from the model plaza, and send the request.

POST/v1/messages

Authorizations

x-api-keystringheaderrequired

Headers

anthropic-versionstringdefault: 2023-06-01required

The Anthropic API version header.

Example:"2023-06-01"

Body application/json

modelstringrequired

A model ID currently available in the model plaza. Check the model plaza for the latest options.

Example:"YOUR_MODEL_ID"
max_tokensintegerdefault: 1024required

The maximum number of tokens to generate in the response.

Required range: x >= 1

Example:1024
messagesobject[]required

Messages in Anthropic format. Each item should contain role and content.

Minimum array length: 1

Show child attributes
messages[].rolestringrequired
Example:"user"
messages[].contentstringrequired
Example:"Hello"

Response

200The Anthropic Messages result from the selected model.
400Invalid request format or parameters.
401The BetterToken API Key is missing or invalid.
402The account has insufficient credit or balance.
429The request exceeded a rate or concurrency limit, or the upstream service is busy.
500The gateway or upstream service returned an error.