For Agents
Send messages to Claude for reasoning, code, and analysis tasks; count tokens before dispatch to manage cost and context. Two-endpoint surface focused on synchronous Messages API usage.
Get started with Anthropic Messages API in minutes using your preferred integration method.
# Add to your MCP client config (Claude Desktop, Cursor, Windsurf)
{
"jentic": {
"url": "https://api.jentic.com/mcp",
"auth": "oauth"
}
}
# Then ask your agent:
"send a message to Claude"
# → Jentic returns the GET /events tool with parameter schema, agent executes.What an agent can do with Anthropic Messages API API.
Send a prompt to Claude with system instructions, tool definitions, and multi-turn conversation history
Receive structured tool-use responses that an agent can dispatch and feed back to Claude on the next turn
Stream tokens from the Messages endpoint for low-latency chat surfaces
Count tokens for a planned messages payload before sending to estimate cost and stay within context limits
GET STARTED
Use for: I need to send a message to Claude for complex reasoning, Generate code with Claude for a Python refactor task, Count tokens in my prompt before sending it to Claude, Stream Claude's response token-by-token to a chat UI
Not supported: Does not handle message batches, model listing, fine-tuning, or admin operations — use for synchronous Claude message completions and token counting only.
Jentic publishes the only available OpenAPI document for Anthropic Messages API, keeping it validated and agent-ready.
Jentic publishes the only available OpenAPI specification for Anthropic Messages API, keeping it validated and agent-ready. Send prompts to Anthropic's Claude models for text generation, reasoning, and code tasks through the Messages API. Two endpoints cover the core flow: POST /messages for synchronous chat completions with system prompts, tool use, and large-context inputs, and POST /messages/count_tokens for cost-aware token estimation before a request is dispatched. Authentication uses the X-API-Key header alongside required anthropic-version and optional anthropic-beta headers for opting into preview features. Suited to agent workflows that need long-context reasoning, structured tool calls, or precise cost control.
Opt into Anthropic preview features via the anthropic-beta header without changing the request body
Pin model behaviour to a specific version using the anthropic-version header for reproducible runs
Patterns agents use Anthropic Messages API API for, with concrete tasks.
★ Long-Context Reasoning
Send a single POST /messages request with up to a 200K-token context window for tasks like multi-document summarisation, codebase Q&A, or contract review. Claude handles large inputs without forcing the agent to chunk and stitch responses, which simplifies retrieval-augmented prompts. Pair with /messages/count_tokens beforehand to confirm the payload fits the chosen model's context limit.
Call POST /messages/count_tokens with the planned messages and system prompt; if under the model limit, call POST /messages with model claude-sonnet and the same payload
Tool-Use Agent Loop
Drive an agent loop where Claude returns tool_use blocks indicating which tool to call next. The host runtime executes the tool, returns the result as a tool_result message, and POSTs the appended history back to /messages. This is the canonical Anthropic pattern for agent orchestration without an external framework, and it lets the same Messages endpoint power both single-shot completions and multi-step agentic workflows.
Send POST /messages with tool definitions, parse the tool_use block from the response, execute the tool, then POST /messages again with the tool_result appended to the conversation
Cost-Aware Prompt Sizing
Estimate token usage before sending a request by calling POST /messages/count_tokens with the same messages and system prompt the agent intends to send. Use the returned count to choose between a smaller and larger Claude model, decide whether to truncate retrieved documents, or stop a runaway agent that is about to exceed a budget cap. Token counting itself does not consume model compute.
Call POST /messages/count_tokens with the candidate messages and system prompt; if the count exceeds 100K, summarise retrieved chunks before calling POST /messages
AI Agent Reasoning via Jentic
An AI agent that needs Claude reasoning can invoke the Messages API through Jentic without managing the X-API-Key header directly. Jentic's intent search returns POST /messages with the messages and tool schema, and the API key is loaded from the vault at execution time so it never enters the agent's tool context. This is especially relevant when the agent itself is built on a different model and only delegates specific reasoning steps to Claude.
Search Jentic for 'send a message to Claude', load POST /messages, and execute with the user's question and a system prompt for the delegated reasoning step
2 endpoints — jentic publishes the only available openapi specification for anthropic messages api, keeping it validated and agent-ready.
METHOD
PATH
DESCRIPTION
/messages
Send a message to Claude and receive a completion
/messages/count_tokens
Count tokens for a planned messages payload
/messages
Send a message to Claude and receive a completion
/messages/count_tokens
Count tokens for a planned messages payload
Three things that make agents converge on Jentic-routed access.
Credential isolation
Anthropic X-API-Key values are stored encrypted in the Jentic vault. Agents receive scoped execution access only — the raw key never enters the agent's prompt or tool context, which matters because Anthropic API keys grant billable per-token access.
Intent-based discovery
Agents search by intent (e.g., 'send a message to Claude') and Jentic returns POST /messages with its messages, tools, and system schema, so the agent does not need to construct the X-API-Key, anthropic-version, and anthropic-beta headers manually.
Time to first call
Direct Anthropic Messages integration: 0.5-1 day for header plumbing, retry logic, and tool-use loop wiring. Through Jentic: under 30 minutes — search, load schema, execute.
Alternatives and complements available in the Jentic catalogue.
Anthropic API
The broader Anthropic API spec covers message batches, model listing, and admin endpoints alongside Messages.
Choose the broader Anthropic API spec when the agent needs message batching, model discovery, or batch-result retrieval rather than just synchronous Messages calls.
OpenAI API
OpenAI's chat completions and responses APIs cover the same prompt-and-tool-use shape as Claude Messages.
Choose OpenAI when the agent needs GPT model coverage or an existing OpenAI tool ecosystem rather than Claude's long-context strengths.
Cohere API
Cohere offers chat, generate, and embed endpoints for text generation and retrieval.
Choose Cohere when the agent needs strong embeddings and rerank alongside chat in a single vendor.
Mistral API
Mistral provides hosted chat completions and embeddings with European data residency options.
Choose Mistral when the agent needs EU-hosted inference or smaller open-weight models alongside hosted endpoints.
Specific to using Anthropic Messages API API through Jentic.
Why is there no official OpenAPI spec for Anthropic Messages API?
Anthropic does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Anthropic Messages API via structured tooling. It is validated against the live API and kept up to date. Get started at https://app.jentic.com/sign-up.
What authentication does the Anthropic Messages API use?
Anthropic uses an API key in the X-API-Key header, paired with a required anthropic-version header that pins the model behaviour and an optional anthropic-beta header for preview features. Through Jentic the API key is stored in the encrypted vault and injected at execution time, so the raw key never enters the agent's prompt context.
Can I count tokens before sending a message to Claude?
Yes. POST /messages/count_tokens accepts the same messages and system prompt shape as POST /messages and returns the token count without consuming model compute. Use this to keep a request under the model's context limit or stay inside a budget cap.
What are the rate limits for the Anthropic Messages API?
The OpenAPI spec does not declare explicit rate limits. Anthropic enforces per-organisation per-minute and per-day quotas based on the account tier, returning 429 with a Retry-After header on overflow. Confirm your tier in the Anthropic console and back off on 429 responses.
How do I send a message to Claude through Jentic?
Run pip install jentic, then search Jentic for 'send a message to Claude'. Jentic returns POST /messages with the full messages, system, and tools schema. Execute with your model name and conversation history; Jentic injects the X-API-Key from the vault.
Does the Messages API support tool use and streaming?
Yes. POST /messages accepts a tools array and returns tool_use blocks the agent dispatches and feeds back via tool_result messages. The same endpoint supports server-sent event streaming when the request enables it, so chat surfaces can render tokens as they arrive.
Why are anthropic-version and anthropic-beta declared as security headers in the spec?
Anthropic requires the anthropic-version header on every Messages call and uses anthropic-beta to gate preview features. The spec models them as additional apiKey security schemes so any client (including Jentic) is forced to send them alongside X-API-Key, even though they are not secrets in the credential sense.