POST
/
v1
/
experimental
/
generate_prompt

프롬프트 도구 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"}
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

Response

200 - application/json
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>"
        }
      ]
    }
  ]
}
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.

usage
object
required

Usage information