POST
/
v1
/
experimental
/
improve_prompt
cURL
curl -X POST https://api.anthropic.com/v1/experimental/improve_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 \
'{
    "messages": [{"role": "user", "content": [{"type": "text", "text": "Create a recipe for {{food}}"}]}],
    "system": "You are a professional chef",
    "feedback": "Make it more detailed and include cooking times",
    "target_model": "claude-3-7-sonnet-20250219"
}'
{
  "messages": [
    {
      "content": [
        {
          "text": "<improved prompt>",
          "type": "text"
        }
      ],
      "role": "user"
    },
    {
      "content": [
        {
          "text": "<assistant prefill>",
          "type": "text"
        }
      ],
      "role": "assistant"
    }
  ],
  "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

Response

Successful Response

The response is of type object.