(10)Use

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.

Chain Robinhood Chain · 4663Code f0806ceOstra Swap 9b622caOstrapad c46fee2

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:

ToolWhat it does
ostra_aiRuns a text, image or video task, paid from the vault tools.ts:278
ostra_ai_jobFollows a video job until it is final and saves the video; free tools.ts:303
ostra_ai_creditThe 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"
}
TaskIts parameters
textmessages, 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
imageprompt; optionally n, quality, aspect_ratio, resolution, seed, background, output_format, image_quality, references
videoprompt, 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:

  1. the agent pays that amount before the task runs;
  2. the task costs what the model charged for it;
  3. 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 2026ChargedCostCredited
Text, cheapest, a short answer0.0000340.0000030.000031
Image, cheapest0.0070.0070
Video, 5 seconds at 480p, cheapest0.1276110.1215320.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 paid ai.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_ai answers its id, and ostra_ai_job reads it until it is final, then saves the MP4. The first final read settles the job's cost and credits the rest.

10.6What to trust#