Skip to content

Docs

One key. Every model.

Ostrak speaks the OpenAI API. Point any OpenAI client at Ostrak, use an agent's key, and pick a model or let ostrak/auto choose.

Quick start.

1. Sign in, add credit with USDG, and create an agent. 2. Create an API key on the agent's page. 3. Use it with base URL https://ostrak.one/v1.

import OpenAI from "openai"; const client = new OpenAI({  baseURL: "https://ostrak.one/v1",  apiKey: process.env.OSTRAK_API_KEY,}); const reply = await client.chat.completions.create({  model: "ostrak/auto",  messages: [{ role: "user", content: "Hello" }],});

API keys.

Send the key as Authorization: Bearer osk_live_…. Each key belongs to one agent, and every call is checked against that agent's limits. Keys are shown once, stored only as a hash, and can be revoked at any time in the console.

A key can call models and read its own status with GET /v1/me (balance, today's spend, limits). It can't change limits, create keys or open the console: only the owner can.

Models.

GET /v1/models lists every model with our price per token: the provider's price plus 8%. Use any listed id, such as openai/gpt-4o-mini, or ostrak/auto.

  • max_tokens (or max_completion_tokens) defaults to 4,096 and is capped at the model's output limit.
  • Tools, tool choice, JSON mode, structured outputs, images, files and reasoning settings are passed through.
  • Provider routing, plugins and n above 1 aren't supported, so prices stay predictable.

Auto routing.

ostrak/auto reads the shape of each request (length, code, tools, attachments, requests to reason step by step) and sends it to the cheapest tier that should handle it. If that model fails, it retries once on the next tier up.

TierModelGets
cheapopenai/gpt-6-lunaShort, simple requests
midopenai/gpt-6.1-terraCode, tools, attachments, long inputs
topanthropic/claude-sonnet-5.5Step-by-step reasoning about code or long inputs, high effort

Fee: the usual 8% plus 30% of what you saved versus the top tier for the same tokens, never more than 50% of the model's own price. No savings, no fee, so auto never costs more than calling the top tier yourself. Every response says which model ran and what you saved.

Streaming.

Set stream: true for server-sent events, exactly as with OpenAI. The last chunk before [DONE] carries usage and an ostrak object with the cost. If your client disconnects, the model is stopped where the provider allows it, and you pay only for what was generated.

What you pay.

Before a call, Ostrak holds the most it could cost (prompt size plus max_tokens). After it, you pay the real cost reported by the provider plus 8%, and the rest of the hold goes straight back. Failed calls cost nothing.

x-request-id: req_3f9c…        # quote this if you contact usx-ostrak-model: openai/gpt-6-lunax-ostrak-cost: 0.000216         # USD, what this call cost youx-ostrak-tier: cheap            # ostrak/auto onlyx-ostrak-saved: 0.004104        # ostrak/auto only, versus the top tier

The same numbers are in the response body under ostrak. Every call gets a receipt with totals only: model, tokens, cost and time. Prompts and replies are never stored.

Limits.

The owner sets these per agent in the console. They're checked on every call, before any money moves:

  • Daily cap: total spend per UTC day.
  • Max per request: compared with the most the call could cost.
  • Allowed models: add ostrak/auto to allow auto routing.
  • Loop breaker: stops identical requests repeated too often.
  • Pause: refuses every call until resumed.

Each account can make up to 120 requests a minute.

Errors.

Errors use OpenAI's shape, so OpenAI SDKs raise them normally: { "error": { "message", "type", "code", "param" } }.

CodeStatusMeaning
invalid_api_key401Missing, wrong or revoked key.
insufficient_balance402Your balance can't cover the most this call could cost. Top up with USDG.
agent_paused403The owner paused this agent.
model_not_allowed403The model isn't on this agent's allowlist.
content_policy403The model provider's content policy blocked the request.
model_not_found404Unknown model id. See GET /v1/models.
invalid_request400Malformed body: missing model or messages, bad max_tokens, n above 1.
max_per_request_exceeded400The call could cost more than the agent's per-request limit. Lower max_tokens or raise the limit.
upstream_bad_request400The model provider rejected the request (the message says why).
request_too_large413Body over 20 MB, or too large for the model.
loop_detected429The same request was repeated too often. The loop breaker stopped it.
daily_cap_reached429The agent spent its daily cap. It resets at 00:00 UTC.
rate_limited429More than 120 requests a minute on this account.
upstream_rate_limited429The model provider is rate limiting. Retry after the Retry-After header.
upstream_error502The model provider failed. Nothing was charged.
service_unavailable503Ostrak can't reach model providers right now. Nothing was charged.
upstream_timeout504The model took too long. Nothing was charged.

Receipts.

Every call that reaches a model writes a receipt: model, input and output tokens, cost, fee, status and time. Never prompts, replies or payees. The receipt's hash is keccak256 of its canonical JSON (sorted keys, no spaces), and Ostrak signs that hash (EIP-191) when the call settles.

Once a day, shortly after 00:00 UTC, all of the previous day's receipts plus one statement per active agent become the leaves of a Merkle tree, and its root is recorded by the OstrakReceipts contract on Robinhood Chain.

  • GET /v1/receipts/:id returns the receipt, its signature, its Merkle proof, the root and the transaction.
  • /verify checks all of it in your browser, against the chain.
  • Receipt signer: 0x6fFAFDa12da2832C29Db551170B046D39927e7bd
  • OstrakReceipts: 0x54A4904f45E7665FB53BD062d0479C773Afc0C1A

Identity and records.

An agent can get an ERC-8004 identity on Robinhood Chain (registry 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432). Ostrak registers it with one click and pays the gas, then sends the identity token to your wallet. If you already registered one, link it by id from a wallet linked to your account.

Records are private by default. Publish one and anyone can see the agent's spend over 30 days, sealed receipts, weeks on record, days without a limit violation and its rung:

  • New: Every agent starts here.
  • Active: 7+ days on record and 50+ sealed receipts.
  • Steady: 28+ days on record, 500+ sealed receipts and 14+ days without a limit violation.
  • Trusted: 84+ days on record, 5,000+ sealed receipts, 30+ days without a limit violation and an ERC-8004 identity.