HTTP API

POST /v1/prompt

The system prompt for some packs, for an agent that runs its own model.

View as Markdown

The same text the web SDK's core.prompt(packs) gives. Not counted.

Keys

Your MorphScreen key in X-MorphScreen-Key: it isn't counted.

Example

MorphScreen's system prompt for some packs, for an agent that runs its own model:

Terminal
curl https://api.morphscreen.com/v1/prompt \
  -H "X-MorphScreen-Key: $MORPHSCREEN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"packs": ["data"]}'

It answers {"prompt": "..."}, the text the web SDK's core.prompt(packs) gives. Send it as your model's first system message (The system prompt). It isn't counted as a call or a render.

Request

PromptRequest

The packs the answers may use (every pack when left out) and the app's own components.

Field Type Required What it is
packs list of string
components list of object

Responses

Status What comes back
200 The prompt.
400 The request can't be run as written: invalid_json, invalid_input, invalid_options or invalid_catalog.
401 No key, or one turned down: your MorphScreen key (morphscreen_key_required, morphscreen_key_invalid) or your OpenRouter key (openrouter_key_required, openrouter_key_invalid).
403 The account is suspended (account_suspended).
413 The body is over 1 MB (payload_too_large).
429 A limit reached, with Retry-After saying how long to wait: requests a minute (rate_limited).
503 Accounts can't be read just now; try again.

Errors come back as {"error": {"code", "message", "type", "metadata": {"error_type", "reason"}}}: type is the reason to act on (rate_limited, plan_quota_reached...). Limits and errors says what to do about each.