full permission (see Get your API key). All examples read them from three environment variables:
Send a message
POST /v1/agents/{agent_id}/chat sends one user message and waits for the reply. Two headers matter besides Content-Type:
Authorization: Bearer <key>Idempotency-Key: any unique value of 1-255 characters per logical request. A UUID is a good choice. It is required on both chat endpoints; see Idempotency.
Read the reply
request_idis also returned as theX-Request-IDheader.conversation_idis the conversation the exchange was stored in. Send another message with the sameexternal_user_idand it continues there.usage.charged_usdis a decimal string with 8 places: what this request cost the owner’s balance.
Continue the conversation
Send a second message with the sameexternal_user_id and a new Idempotency-Key:
409 conversation_busy with a Retry-After header; wait and retry.
Next steps
Streaming
Show the answer as it is generated.
Conversations
List conversations and page through messages.
Errors
Every code the API can return and what to do about it.
API reference
Full request and response schemas, with a playground.