Ostra AI
Ostra AI runs text, image and video tasks for an agent and charges each one in USDG from its vault, over x402. The agent names what it wants and the most it will pay, never a model; it pays what the task cost, and what it paid beyond that waits as credit for its next task.
10.1What Ostra AI is#
An AI gateway at ai.ostraagent.xyz, run by Ostra, that sells tasks per request: no account, no subscription, no API key. Its address is in the MCP package, so an agent needs nothing to set up packaged.ts:1-28. Three tools reach it, through the core's Ostra AI client ai.ts:1-15:
| Tool | What it does |
|---|---|
ostra_ai | Runs a text, image or video task, paid from the vault tools.ts:278 |
ostra_ai_job | Follows a video job until it is final and saves the video; free tools.ts:303 |
ostra_ai_credit | The vault's credit with Ostra AI; free tools.ts:322 |
10.2Asking for a task#
A task names its parameters and a maxPrice in USDG:
ostra_ai {
"task": "text",
"request": { "messages": [{ "role": "user", "content": "Summarise this filing in five lines: ..." }], "max_tokens": 600 },
"maxPrice": "0.05"
}| Task | Its parameters |
|---|---|
| text | messages, max_tokens; optionally quality (best, balanced or cheapest; default best), privacy (no_training, zdr or standard; default no_training), temperature, top_p, seed, stop, tools, tool_choice, response_format, reasoning |
| image | prompt; optionally n, quality, aspect_ratio, resolution, seed, background, output_format, image_quality, references |
| video | prompt, duration in seconds; optionally quality, resolution (such as 480p), aspect_ratio, size, frame_images, references, generate_audio, seed |
No model is named. The gateway picks one by its quality rating among those that can do the task within maxPrice: text by the Artificial Analysis Intelligence Index, images and video by the LMArena leaderboard. A task no model can do within the price is refused with the reasons, and nothing is paid. Each answer names the model that ran it.
10.3What a task costs#
For each task the gateway sets an upfront amount within maxPrice, from the model it chose:
- the agent pays that amount before the task runs;
- the task costs what the model charged for it;
- the rest of what was paid becomes the vault's credit with Ostra AI, and a task that did not run gives all of it back as credit.
Credit pays first on the next task: up to all of it but one base unit (0.000001 USDG), the rest paid from the vault, which is what lets the gateway know the credit is the vault's. Every answer carries a paid block: what was charged, how much came from the channel and how much from credit, what the task cost, what was credited, and the credit now.
| A run on 22 Oct 2026 | Charged | Cost | Credited |
|---|---|---|---|
| Text, cheapest, a short answer | 0.000034 | 0.000003 | 0.000031 |
| Image, cheapest | 0.007 | 0.007 | 0 |
| Video, 5 seconds at 480p, cheapest | 0.127611 | 0.121532 | 0.006079 |
Prices follow the models and change over time; maxPrice is what bounds a task.
10.4Paying from the vault#
The agent pays through an x402 payment channel from its USDG vault to Ostra AI. The first task opens one with deposit (1 USDG by default); each task after that is a voucher signed on the agent's machine, with no transaction. Ostra AI claims the vouchers and closes the channel once it has been idle, and what the channel did not spend goes back to the vault. The vault is named as the payer of every task, so what a task did not cost is the vault's credit and nobody else's ai.ts:114-144.
Any x402 client can buy tasks too: the gateway also takes an x402 exact payment in USDG from a wallet, and keeps that wallet's credit the same way.
10.5Text, images and video#
- Text is asked as a stream, so an answer that takes minutes is not cut off on the way (the server waits up to 11 minutes); it puts it back together into one answer: its content, reasoning, tool calls and finish reason, with the model, usage and
paidai.ts:42-86. A stream the model broke off is reported as failed, with what came before, and what it was charged is credit. - Images come back inline and are saved as files in the agent's directory,
~/.ostra/ai, typed by their bytes. - Video is a job:
ostra_aianswers its id, andostra_ai_jobreads it until it is final, then saves the MP4. The first final read settles the job's cost and credits the rest.