Pular para o conteúdo
Cadastre-se grátis
Referência da API

API Anthropic Messages

Teste a API Messages compatível com Anthropic da BetterToken: x-api-key, anthropic-version e POST /v1/messages.

POST /v1/messages

Use este endpoint para Claude Code, o SDK da Anthropic e aplicações que usam a API Anthropic Messages.

Teste no Playground

No Playground à direita, insira sua API Key no campo x-api-key, mantenha anthropic-version como 2023-06-01, escolha um modelo disponível e envie a solicitação.

Endpoints relacionados

POST/v1/messages

Autorizações

x-api-keystringheaderobrigatório

Cabeçalhos

anthropic-versionstringpadrão: 2023-06-01obrigatório

The Anthropic API version header.

Exemplo:"2023-06-01"

Corpo application/json

modelstringobrigatório

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

Exemplo:"YOUR_MODEL_ID"
max_tokensintegerpadrão: 1024obrigatório

The maximum number of tokens to generate in the response.

Intervalo obrigatório: x >= 1

Exemplo:1024
messagesobject[]obrigatório

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

Minimum array length: 1

Show child attributes
messages[].rolestringobrigatório
Exemplo:"user"
messages[].contentstringobrigatório
Exemplo:"Hello"

Resposta

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.