Skip to main content
POST
/
api
/
payments
/
prepare
Payment intents
curl --request POST \
  --url https://api.compose.market/api/payments/prepare \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --header 'x-chain-id: <x-chain-id>' \
  --data '
{
  "service": "<string>",
  "action": "<string>",
  "resource": "<string>",
  "method": "<string>",
  "maxAmountWei": "<string>",
  "meter": {},
  "composeRunId": "<string>",
  "idempotencyKey": "<string>",
  "modelId": "<string>",
  "provider": "<string>",
  "modality": "<string>",
  "usage": {},
  "media": {}
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.compose.market/llms.txt

Use this file to discover all available pages before exploring further.

Payment intent routes are used by gateway surfaces that reserve a budget before work and settle the final metered amount after work. Amounts are USDC atomic units with 6 decimals.

Routes

MethodPathDescription
POST/api/payments/prepareAuthorize a payment intent from a Compose Key.
POST/api/payments/settleSettle a prepared intent.
POST/api/payments/abortAbort a prepared intent without settlement.
POST/api/payments/meter/modelCompute metered cost for a model output.

Prepare body

service
string
required
Service namespace, such as agent, workflow, or inference.
action
string
required
Action name within the service.
resource
string
required
Resource URL or identifier being paid for.
method
string
required
HTTP method being paid for.
maxAmountWei
string
Maximum authorized USDC atomic amount.
meter
object
Metered settlement shape: subject plus lineItems.
composeRunId
string
Optional caller run ID.
idempotencyKey
string
Optional caller idempotency key.

Headers

Authorization
string
required
Bearer compose-....
x-chain-id
number
required
Chain ID used for the payment intent.

Meter body

modelId
string
required
Public catalog model ID.
provider
string
Optional provider override for exact provider billing resolution.
modality
string
required
Output modality to bill.
usage
object
Token or provider usage metadata.
media
object
Media evidence for image, audio, video, or other non-token billing.