Request body
prompt— Required instructions or seed text.model— Optional model identifier; defaults to the workspace text model (e.g.,sonnet).maxTokens— Optional upper bound for the completion length; defaults to800.temperature— Optional float between0and1; higher values increase creativity.metadata— Optional object that attaches custom keys for downstream auditing.
Sample request
Response
Returns200 OK with the generated text in result.content, token usage metrics under result.usage, and the deterministic jobId that you can reference in logs or attach to downstream automations.
Tips
- Set
temperaturebelow0.3when you need repeatable copy for approval workflows. - If you need streaming output, append
?stream=trueto the request and consume the server-sent events feed. - Even when responses return synchronously, you can retrieve the job later via
GET /jobs/{jobId}for auditing or replay.
x402 flow
Text generation is priced via Coinbase’s x402 protocol. On unpaid requests Horizon returns402 Payment Required with a PaymentRequiredResponse payload. Example:
- Send the
acceptsentry to your facilitator as outlined in Client & server responsibilities. - Use the facilitator to verify and settle the payment (
POST /verify,POST /settle). You receive a Base64Payment Payload. - Retry the original request including the payload in an
X-PAYMENTheader: - Horizon validates the payment (locally or through the facilitator) and resumes processing. Successful responses can include
X-PAYMENT-RESPONSEwith the settlement receipt.
Body
application/json