Skip to main content
Coming soon. Prompt improvement is not enabled yet. Until it is, POST /prompts/improve returns 503 service_unavailable with the message Prompt improvement is not available yet., and the MCP tool improve_prompt does not appear in the server’s tool list. Nothing is charged, and a disabled call does not count against your rate limit. The credits, idempotency, and error behaviour on this page apply from launch.
The prompt improver rewrites a short prompt into a detailed one that is ready for an image or a video generation.
  • POST /prompts/improve — improve one prompt for target image or video.
  • The MCP server will have the same operation as the tool improve_prompt — see MCP tools.
The call is synchronous: the 200 response contains the improved prompt. There is no job to poll and no webhook.

Example: improve, then generate

Improve a red bicycle in a park for an image:
200 OK
Then send improved_prompt as the prompt of POST /images/generations (or of the MCP tool generate_image). For target: "video", send it to POST /videos/generations.

Request

Unknown body fields are ignored. The 200 response has four fields: Every response carries an X-Request-ID header. Quote it when you contact support.

Order of checks

A call is checked in this order. The first check that fails decides the response:
  1. Authentication — 401 (invalid_api_key, or invalid_token for an OAuth access token).
  2. Availability — 503 service_unavailable while prompt improvement is not enabled. This check runs before the rate limiter, so a disabled call does not count against your rate limit.
  3. Rate limit — 429 rate_limited.
  4. Scope — 403 missing_scope.
  5. Validation — 422 validation_error.

Credits

From launch, each call costs 1 credit. The credit is charged before the AI model runs:
  • If the balance this credential can spend is too low, the call returns 402 — nothing is charged and the model does not run. See When you run out of credits.
  • If the AI provider fails, the credit is refunded automatically and the call returns 502 provider_error.
  • In the rare case that the refund cannot be confirmed at once, the call returns 500 refund_pending. Samsa retries the refund automatically — you do not need to do anything.

Idempotency

Send an optional Idempotency-Key header (1–255 printable ASCII characters, for example a UUID) to retry safely after a timeout or a network error: Keys are scoped to the owner of the credential — the API key’s creator or the OAuth user — within the organization. REST calls, MCP calls, and all credentials of the same owner share one key namespace. Two different users can use the same key value without a conflict.

Scope

A credential with any one of the images.generate, images.edit, or videos.generate scopes can call the improver — the scopes of the operations an improved prompt is for. There is no separate scope, so existing keys work. A key with none of the three gets 403 missing_scope.

Rate limits

Each enabled call counts against the key’s per-key request rate (429 rate_limited with Retry-After). The call creates no job, so it does not use the organization’s concurrency cap.