Before you start
- An agent whose budget admits the inference provider. The default allow-all budget does.
- An API key for that agent. See Mint a key.
Pick a model
Browse the Inference page, or list models fromGET /v1/models with no key. See How the Inference page shows prices for what each entry carries.
Set up the client
The Inference page’s How to connect card walks through these three values with ready-to-paste snippets for curl, Python, and TypeScript. Under the card, Connect your harness shows the block to add the endpoint as a custom provider in Hermes or in OpenClaw. The Agents page and each agent’s page link there with Set up inference.
Send images
Models that accept images take them in the request, the way the provider’s own API does. Put animage_url part in a message’s content:
- Size. Keep a request under about 25 MB, the most the model provider accepts. An image sent inline counts toward it, and base64 encoding makes an image about a third larger than its file, so a request fits about 18 MB of images. Resize or compress the images, or send fewer per request. A request that’s too large returns
request_too_largeorinvalid_request(onPOST /v1/messages, the error type isrequest_too_largeorinvalid_request_error), and nothing is charged unless the response names a transaction. See Limits. - Inline or by URL. A base64 data URI (
data:image/png;base64,...) in animage_urlpart works with every model that reads images. Some providers also accept a publichttpsURL in its place and fetch the image themselves, so it doesn’t count toward the size limit; check the model’s provider before you rely on it. - Cost. An image is billed as input tokens, and one image can cost thousands of them. For example, a 400 KB PNG sent to
openai/gpt-4o-minicost about 37,000 input tokens. Downscale an image to the detail the task needs before you send it.
POST /v1/messages, use an image content block instead: its source carries "type": "base64", the media_type, and the base64 data without the data: prefix. See Use Claude Code or an Anthropic SDK.
Control repeat requests (optional)
Send anIdempotency-Key header to control whether a repeated request shares a charge or pays again. See Managing idempotency keys.
Raise your client’s timeout
Give your client more than three minutes, so it doesn’t give up on a call you already paid for. A streamed response can run for up to 30 minutes, so for a streamed request, set a total timeout above 32 minutes, which leaves room for the payment before the stream starts. If your client limits each wait instead, set the wait for the response headers above 32 minutes too, because a retried payment can delay them, and set each wait for a chunk, the first included, above 10 minutes. A non-streamed request stops if the model hasn’t answered 2 minutes after the payment is sent, and a reasoning model can think for longer than that before it answers, so send"stream": true for reasoning models and other long calls.
To generate an image or a video instead, see Generate an image or video. For speech, sound effects, or music, see Generate speech, sound effects, or music. To run Claude Code or an Anthropic SDK, see Use Claude Code or an Anthropic SDK. For a free typed judgment, see Ask for a typed judgment.
See Paid inference for the full flow, and Errors and retries for the failure modes, including over-budget declines.