POST
/
v1
/
experimental
/
generate_prompt
curl -X POST https://api.anthropic.com/v1/experimental/generate_prompt \
     --header "x-api-key: $ANTHROPIC_API_KEY" \
     --header "anthropic-version: 2023-06-01" \
     --header "anthropic-beta: prompt-tools-2025-04-02" \
     --header "content-type: application/json" \
     --data \
'{
    "task": "a chef for a meal prep planning service",
    "target_model": "claude-3-7-sonnet-20250219"
}'
{
  "messages": [
    {
      "content": [
        {
          "text": "<generated prompt>",
          "type": "text"
        }
      ],
      "role": "user"
    }
  ],
  "system": "",
  "usage": [
    {
      "input_tokens": 490,
      "output_tokens": 661
    }
  ]
}

프롬프트 도구 API는 비공개 연구 미리보기 단계에 있습니다. 비공개 연구 미리보기 참여 요청.

시작하기 전에

프롬프트 도구는 프롬프트를 생성하고 개선하는 API 세트입니다. 다른 API와 달리, 이것은 실험적 API입니다: 액세스를 요청해야 하며, 다른 API와 같은 수준의 장기 지원 약속이 없습니다.

이러한 API는 Anthropic Workbench에서 사용할 수 있는 것과 유사하며, 다른 프롬프트 엔지니어링 플랫폼과 플레이그라운드에서 사용하기 위한 것입니다.

프롬프트 생성기 시작하기

프롬프트 생성 API를 사용하려면 다음이 필요합니다:

  1. 프롬프트 도구 API의 비공개 연구 미리보기에 참여했을 것
  2. SDK가 아닌 API를 직접 사용할 것
  3. 베타 헤더 prompt-tools-2025-04-02 추가

이 API는 SDK에서 사용할 수 없습니다

프롬프트 생성

Headers

anthropic-beta
string[]

Optional header to specify the beta version(s) you want to use.

To use multiple betas, use a comma separated list like beta1,beta2 or specify the header multiple times for each beta.

x-api-key
string
required

Your unique API key for authentication.

This key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the Console. Each key is scoped to a Workspace.

Body

application/json
task
string
required

Description of the prompt's purpose.

The task parameter tells Claude what the prompt should do or what kind of role or functionality you want to create. This helps guide the prompt generation process toward your intended use case.

Example:

{"task": "a chef for a meal prep planning service"}
Examples:

"a chef for a meal prep planning service"

target_model
string | null
default:

The model this prompt will be used for. This optional parameter helps us understand which models our prompt tools are being used with, but it doesn't currently affect functionality.

Example:

"claude-3-7-sonnet-20250219"
Required string length: 1 - 256
Examples:

"claude-3-7-sonnet-20250219"

Response

200
application/json
Successful Response
messages
object[]
required

The response contains a list of message objects in the same format used by the Messages API. Typically includes a user message with the complete generated prompt text, and may include an assistant message with a prefill to guide the model's initial response.

These messages can be used directly in a Messages API request to start a conversation with the generated prompt.

Example:

{
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "You are a chef for a meal prep planning service..."
        }
      ]
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "text",
          "text": "<recipe_planning>"
        }
      ]
    }
  ]
}
Examples:
[
  {
    "content": [
      {
        "text": "<generated prompt>",
        "type": "text"
      }
    ],
    "role": "user"
  }
]
system
string
default:
required

Currently, the system field is always returned as an empty string (""). In future iterations, this field may contain generated system prompts.

Directions similar to what would normally be included in a system prompt are included in messages when generating a prompt.

Examples:

""

usage
object
required

Usage information