Templates · AI
Claude API collection template
Send messages to Claude, count tokens and list models with the Anthropic API.
What's inside
Talk to Claude with the Messages API: a single message, a system prompt and a multi-turn conversation, plus token counting and the models list. Change model in the environment to try another Claude model.
5 requests in 2 folders · Base URL https://api.anthropic.com/v1 · API key in the x-api-key header
Set it up
- Open Claude API in Requestarium (or in the app: Import, Start from a template) and import it. You get the collection and a "Claude API" environment.
- Create an API key in the Claude Console (platform.claude.com), Settings, API keys. Requests are billed to your Anthropic account.
- Fill in the environment, pick it in the environment menu and send the first request.
Environment variables
| Variable | What it is |
|---|---|
anthropicApiKeysecret | API key, sk-ant-… |
model | Claude model id; "List models" shows the others. |
Requests
Messages
- POSTSend a message
/messagesOne user message.
- POSTMessage with a system prompt
/messagesSets the role with a system prompt.
- POSTMulti-turn conversation
/messagesThe API is stateless: send the whole conversation each time.
- POSTCount tokens
/messages/count_tokensInput tokens of a request before you send it.
Models
- GETList models
/modelsAvailable Claude models; a quick way to check the key.