All tools

Create a message

Returns Claude's next message for a prompt or conversation, such as a drafted email or a label for a record.

View on GitHub
Updated Sep 27, 2026Available asCLIAPI

Description

Send `anthropic-version: 2023-06-01` and `content-type: application/json` with the key. The body needs `model`, `max_tokens` and `messages`; a `system` prompt is optional. On the CLI, `claude -p "<prompt>"` prints the response without starting an interactive session.

create-message.md

Create a message

Returns Claude's next message for a prompt or conversation, such as a drafted email or a label for a record.

Send anthropic-version: 2023-06-01 and content-type: application/json with the key. The body needs model, max_tokens and messages; a system prompt is optional. On the CLI, claude -p "<prompt>" prints the response without starting an interactive session.

Set up

Use the first option your agent supports.

CLI (official)

Install the command, then confirm it runs.

curl -fsSL https://claude.ai/install.sh | bash
claude --version

Run claude -p.

API (official)

Before doing anything else, make one read-only call to confirm access.

Rules

  • Ask the user before anything that sends messages, costs money, or changes data.
  • Never print API keys.

Built from these files in the repository

The layout and the rules come from lib/catalog/render-markdown.ts, the set-up wording from lib/catalog/render-access.ts.

Ways in

RouteSourceCallRequiredDocs
CLIOfficialclaude -pOAuthDocs
APIOfficialPOST /v1/messagesAPI key in $ANTHROPIC_API_KEYDocs

Workflows using Create a message