x402

Prompt Optimize (x402)

Analyze and improve a prompt. Returns improved version with changes and reasoning, clarity score comparison, and techniques applied.

post/x402/v2/prompt-optimize

Request

  • Base URL: https://api.strale.io
  • URL: https://api.strale.io/x402/v2/prompt-optimize
  • Auth: none required

Request body

current_promptstring required
task_descriptionstring

Response

Success

clarity_scoreobject
improved_promptstring

Example response

{
  "changes_made": [
    {
      "change": "Added explicit role definition and system context",
      "reasoning": "Clarifies the purpose and expected behavior, reducing ambiguity about what the prompt should accomplish"
    },
    {
      "change": "Restructured vague input into clear task with specific output requirements",
      "reasoning": "Provides measurable evaluation criteria rather than implicit expectations"
    },
    {
      "change": "Added numbered output format expectations",
      "reasoning": "Enables consistent, structured responses that can be programmatically evaluated"
    },
    {
      "change": "Included meta-analysis request (confidence, limitations)",
      "reasoning": "Makes the testing process more comprehensive and diagnostic for capability assessment"
    }
  ],
  "issues_found": [
    "Extremely vague - unclear what should happen with 'test_value'",
    "No explicit task definition or expected output format",
    "Cannot be effectively evaluated or reproduced",
    "No context for what 'automated capability testing' means",
    "Insufficient for meaningful testing purposes"
  ],
  "clarity_score": {
    "improved": 9,
    "original": 1
  },
  "improved_prompt": "You are an automated capability testing system. Process the following test input and provide structured feedback on your ability to handle it: 'test_value'. Return your analysis including: (1) successful parsing of the input, (2) any constraints or limitations encountered, (3) confidence level in handling this input type, and (4) recommendations for improvement.",
  "techniques_applied": [
    "Role-based prompting",
    "Task decomposition with numbered steps",
    "Explicit output structure definition",
    "Context clarification",
    "Meta-cognitive prompting for self-assessment"
  ],
  "improved_token_estimate": 65,
  "original_token_estimate": 2
}

Changes

No recorded changes to this operation across all 1 revision of this API.