[Vision](https://compute.finance) | [Oracle](https://oracle.compute.finance) | [Documentation](https://docs.compute.finance) --- # Compute Finance -- Documentation API reference, guides, and integration documentation for Compute Finance. --- ## Early Access Compute Finance is in early access. The CPI Oracle and public API are live. Register a Compute Finance ID to join the waitlist. [REQUEST ACCESS](https://compute.finance/login) --- ## What is the CPI? The Compute Price Index ("CPI") is a public benchmark that tracks the cost of AI inference across major providers. It produces a single equal-weighted reference price -- the Standard Compute Unit ("SCU") -- calculated from a basket of model-family representatives. `GET https://api.compute.finance/v1/oracle/basket` publishes the current membership. ### The Problem LLM inference pricing is fragmented. Every provider quotes pricing differently — per token, per character, per request, per model. There is no standardized way to benchmark or compare the cost of AI computation across models and providers. You need a verifiable pricing reference you can audit independently. ### The Solution The CPI is an equal-weighted basket of AI models across major providers that produces a single, verifiable unit of account: the Standard Compute Unit (SCU). The SCU represents the USD cost of a fixed reference workload (token counts published via the API) taken as the geometric mean across the full basket. ### Key Properties - **Verifiable** -- Basket composition and every basket member's input/output price are published on-chain via the OracleRegistry contract on Base, so anyone can independently verify the index. Cache and reasoning rates are live-catalog data and are not attested on-chain. - **Diversified** -- One slot per model family, spread across every major provider, so no single provider or model version dominates the index. - **Gaming-resistant by math** -- The Nth-root damping of the geometric mean and the one-family-one-slot rule prevent any single model or provider from dominating the index. No governance committee, no outlier caps. - **Versioned** -- Every published revision permanently carries the methodology version that produced it. The active version is served by `GET /v1/oracle/methodology` and the `X-Methodology-Version` response header on every `/v1/oracle/*` response. - **Open methodology** -- The formula is deterministic and reproducible from the public API (the attested `inputPriceUsd18PerM` / `outputPriceUsd18PerM` of `GET /v1/oracle/manifest/{metadataHash}`) and the methodology document. --- ## Compute Finance ID Your Compute Finance ID (CF ID) is your identity across all Compute Finance surfaces. Created on first sign-in via email or wallet, it ties together your profile, points balance, and referral code into a single record. ### What CF ID stores | Field | Description | |---|---| | `cf_id` | Public identifier -- format: cf_usr_XXXXXXXXXXXX | | `email` | Used for notifications. Optional for wallet-only sign-in. | | `wallet_address` | On-chain address on Base. Created via account abstraction or connected externally. | | `display_name` | User-chosen name. Defaults to a truncated email or wallet address. | | `referral_code` | Permanent 8-character code -- format: cf_ref_XXXXXXXX | | `points_balance` | Current points total, denormalized from the points ledger | ### Sign-in flows Two sign-in methods, both produce a CF ID: - **Email** -- Enter your email, receive a 6-digit code, verify. A smart wallet is created on Base and associated with your email. No seed phrase required. - **Wallet** -- Connect MetaMask, Coinbase Wallet, or any WalletConnect-compatible wallet. Sign a SIWE message. Your wallet address becomes your CF ID's primary identifier. Both flows converge on the same CF ID record. You can add an email to a wallet-only account later from your settings. --- ## Organizations An organization lets several people work on one account — its owner's. The owner's balance pays for the members' requests, and the owner's API keys, spending limits, pools and history are shared with them. Every member keeps a personal account of their own alongside. ### Personal and organization context While signed in, a caller's requests run in one context, remembered on the profile. Every account page shows the active context and the caller's role in it in the account switcher at the top of the navigation — at the top of the page on a narrow screen — and switches from there in one step; Settings → Organizations switches too: - **Personal** -- the caller's own account: balance, API keys, spending limits, pools and history. - **Organization** -- the owner's account. Balance, API keys, spending limits, pools and history are the owner's; web chat is paid from the owner's balance, and a key issued in this context belongs to the owner's account. The caller's role decides what they may change. Accepting an invitation makes that organization the active context. Creating an organization makes the creator its owner but does not switch to it. One user owns at most 10 organizations. Over the API, `POST /v1/orgs/context` with an `orgId` switches and answers the context now active, `{"orgId": null}` returns to the personal context, and `POST /v1/invitations/accept` switches into the organization it joins. `GET /v1/account` reports the active context as `org` (`null` = personal). Some things keep the context they started in, whichever one is active later: a connected app (app grant) acts in the context its grant was issued for, a Spark proposal is carried out in the context it was made in, and a `ct_live_*` API key always spends the account it was issued on. ### Roles Each member holds exactly one role -- Owner, Admin or Member -- and every role includes everything the role below it allows. The table is generated from the same declaration the API enforces. An action the caller's role does not allow is refused with `org_role_required`, whose `details.minimumRole` names the role it needs; the one exception is member addresses, which `GET /v1/orgs/{id}/members` returns masked to a Member rather than refusing. | What the role allows | Owner | Admin | Member | |---|---|---|---| | Send inference requests and chat, paid from the organization's balance | Yes | Yes | Yes | | See the organization's API keys, spending limits, pools, history and balance | Yes | Yes | Yes | | See who belongs to the organization and the role each member holds | Yes | Yes | Yes | | Create, edit, freeze and revoke the organization's API keys | Yes | Yes | No | | Set the organization's spending limits | Yes | Yes | No | | Create, edit and delete the organization's pools, see and change who is in them, and accept, reject or revoke the endpoints suppliers offer them | Yes | Yes | No | | Connect apps that make changes to the organization's account | Yes | Yes | No | | See every member's full email address | Yes | Yes | No | | See pending invitations; invite Members, resend or revoke their invitations, and remove Members | Yes | Yes | No | | Invite Admins, resend or revoke their invitations, and remove Admins | Yes | No | No | | Delete the organization once every other member has been removed | Yes | No | No | A role is never edited: to change someone's role, remove them and invite them again. ### Who hands out which role A role a member can hand out is one they can take back. Inviting to a role, resending or revoking an invitation to it, and removing a member who holds it all require a role that could remove that member. The owner role is never handed out. | Role | Invites and removes | |---|---| | Owner | Member, Admin | | Admin | Member | | Member | Nobody | ### Invitations - An invitation is addressed to one email address. Only a signed-in account whose confirmed profile email is that address can accept it (`POST /v1/invitations/accept`), so a forwarded link admits nobody else. - The link carries a one-time token, of which only a SHA-256 hash is stored. It expires 7 days after it is issued. - An organization holds at most 50 pending invitations. An expired invitation takes no slot, and inviting an address whose only invitation has expired replaces it. - Resending issues a new link and a new expiry, and the previous link stops working. Revoking withdraws an invitation for good; an accepted invitation cannot be revoked. - An invitation is `pending`, `expired`, `revoked` or `accepted`. While it is pending, `POST /v1/invitations/preview` answers with the organization, the inviter, the role and the expiry, and the invitation page and email list what that role allows; in any other state the preview answers with the state alone. The member who accepted an invitation and still belongs can read which organization it admitted them to with `POST /v1/invitations/joined`, so reopening the link leads them back into it; for anyone else that call names no organization. ### What always stays personal These act on the caller's own account whichever context is active, so none of them reaches the owner's account from inside an organization: - Funding -- card top-ups, USDC swaps and stablecoin top-ups into the balance. - Withdrawal of `$COMPUTE` from the balance. - Saved cards. - Auto top-up. ### Removing a member, leaving and deleting - Removal takes effect at once: the removed member's next request runs in their personal account, and every API key they issued on the owner's account is revoked in the same transaction. - An Admin or a Member can leave the organization, with the same effect on the keys they issued. - The owner can neither leave nor be removed. The owner can delete the organization instead, once every other member has been removed. - Deleting a profile deletes an organization its user owns alone; while an organization they own still has other members, the profile deletion is refused. --- ## Spark assistant [Guide](https://docs.compute.finance/#spark) · [Settings](https://compute.finance/settings?section=spark) Spark answers questions about the signed-in user's balance, spending, API keys and recent transactions, using only account data the user is allowed to see. It is available in the app, documentation and Oracle; administration is excluded. 1. Choose the personal or organization context in the app and open Spark. 2. Review the cost and the data sent to the AI provider, then turn on Spark. 3. Ask a question, naming the key or period when relevant, and press Send. Follow-up questions use the recent conversation. **Cost.** Answers are charged at model prices plus the routing fee disclosed before enabling Spark. Each answer's charge, the conversation total and available balance are shown in dollars. Account spending limits apply. Failed attempts with no useful answer are free; a useful partial answer can still be charged. Account notifications are free, remain available when paid answers are off, and show when their figures were recorded. **Changes.** “Allow Spark to make changes” is a separate permission in Settings. Spark can propose creating, freezing or unfreezing an API key, setting account spending limits, and turning auto top-up off or configuring it with a saved card. The user reviews a confirmation card and presses Confirm; current account permissions still apply. Card auto top-up needs a saved card and email address and always belongs to the caller's personal account. Funding, withdrawals and wallet approvals remain user-driven. Newly created key secrets are revealed once through the card's link, never to Spark. Expired confirmations require a new request. **Data.** The AI provider receives the question, current page, recent conversation and app language, plus authorized account facts: organization and role, balance and spending, limits, API-key metadata, card top-ups, auto top-up and transaction history. Full API keys, card details and credentials are excluded. **Conversations.** Each personal or organization context has its own saved conversation. Page changes keep it; switching back to a context restores it. “New conversation” resets the context used for answers and the conversation total; earlier messages remain readable above a divider. Only a bounded recent history is used for answers. Signing out or turning Spark off deletes saved conversations. ## Points Points track your activity with Compute Finance, including daily sign-ins, AI requests, contributions and referrals. Higher tiers depend on total points earned. Your points history is available when you are signed in. ### Tiers | Tier | Min Points | |---|---| | Explorer | 0 | | Starter | 500 | | Builder | 2,000 | | Architect | 5,000 | | Titan | 15,000 | ### How points are earned Examples of recurring rewards and one-time achievements. | Channel | Amount | Trigger | Frequency | |---|---|---|---| | Signup bonus | 100 pts | New CF ID profile created on first sign-in | Once per account | | Referral (referrer) | 250 pts | Valid referral confirmed when the invited user creates a profile | Per successful referral | | Referral (referred user) | 50 pts | New profile created with a valid referral code | Once per account | | Daily check-in | 10 pts | First successful daily check-in for the UTC calendar day | Once per day | | Oracle interaction | 5 pts | Authenticated claim through the points API | Once per user per UTC calendar day | ### Streaks Check in on consecutive UTC days to build a streak. Each milestone awards a bonus once per streak, in addition to the daily reward. Missing a day restarts the streak at your next check-in. See the [Points guide](https://docs.compute.finance/#points) for milestone days and rewards. ### Leaderboard The leaderboard shows rank, display name, total points and tier. It does not expose wallet addresses or email addresses. The API supports category and result-limit filters. ### Non-transferability Points are an engagement score. They have no monetary value and cannot be transferred or converted into tokens, currency or API credits. ### API endpoints These endpoints read points data or request daily rewards. Personal endpoints require authentication; the leaderboard is public. Paths are against `https://api.compute.finance`. | Method | Path | Description | |---|---|---| | GET | `/v1/points` | Your earned and spent points, current balance, tier and check-in streak | | GET | `/v1/points/history` | Your paginated point awards and spending | | GET | `/v1/points/leaderboard` | Public ranking by points, with category and result-limit filters | | POST | `/v1/points/daily-checkin` | Record the daily check-in and award any reached streak milestone | | POST | `/v1/points/claim-oracle` | Claim the daily Oracle reward | ### Points history response `GET /v1/points/history` returns your point awards and spending. Each item in `entries` has the fields below. | Field | Type | Description | |---|---|---| | `id` | string | Unique entry identifier | | `userId` | string | The user whose points changed | | `category` | string | Category identifier for the point change | | `action` | string | Action identifier, such as `daily_login` or `first_csv_export` | | `points` | number | Signed integer: positive for awards, negative for points spent | | `metadata` | unknown | Event-specific JSON data; its structure depends on the action | | `createdAt` | string | When the entry was recorded, as an ISO 8601 timestamp | The response includes `total`, `page`, `limit` and `totalPages` for pagination. `GET /v1/points` returns `totalEarned`, `totalBurned` and `currentBalance`. --- ## Referral Program Every CF ID includes a unique referral code (8 characters). Share your link to invite new users -- both sides earn points. The program uses first-touch attribution with a 30-day cookie window. ### Referral rewards | Event | Points | Who Earns | |---|---|---| | New user signs up with your code | 50 pts | New user (welcome bonus) | | You referred a new user | 250 pts | Referrer | ### Sharing your referral link Referral URLs have the path `/r?c={ref}` on `https://compute.finance`, where `{ref}` is your `cf_ref_*` code. Find your referral code in your Compute Finance ID settings. Share buttons are available for X, LinkedIn, Telegram, and copy-to-clipboard. The link uses a 30-day attribution cookie -- referrals count when the referred user creates a CF ID within 30 days of clicking your link. ### Attribution model Referral attribution is first-touch with a 30-day window. The first referral link a user clicks is the one credited if they sign up within the window. Subsequent referral links from other users do not overwrite the original cookie. How it works step by step: 1. A user visits the referral link (`/r?c={ref}` on `https://compute.finance`) 2. The server redirects to `https://compute.finance` and sets a cookie: `cf_ref={ref}` with `Max-Age=2592000` (30 days), `SameSite=Lax`, `Secure` 3. The click is recorded in the database with the referral code, timestamp, hashed IP address, and user agent 4. If the user signs up within 30 days -- even if they navigate directly to `https://compute.finance` without the referral link -- the cookie is read during CF ID creation and the referral relationship is stored 5. If the user has already clicked a different referral link, the first-touch cookie is preserved ### Anti-gaming rules The referral program enforces several rules to prevent farming and abuse. None of these rules surface error messages -- invalid referrals are silently ignored to avoid leaking information about user accounts. | Rule | Implementation | |---|---| | No self-referral | If the `cf_ref` cookie matches the signing-up user's own referral code, the referral is silently ignored | | Email deduplication | One CF ID per email -- a user cannot create multiple accounts with the same email to farm referral points | | IP rate limiting | Maximum 10 CF ID creations per IP address per 24 hours, preventing mass account creation from a single source | | Click rate limiting | Maximum 100 clicks per referral code per hour. Clicks beyond the limit are not recorded. | | Disposable email detection | Optional: reject signups from known disposable email domains (mailinator, guerrillamail, etc.) | ### Referral dashboard Your CF ID profile includes a referral dashboard showing: - Total referral link clicks (all-time) - Total signups from your referral link - Conversion rate (signups / clicks) - Total points earned from referrals - List of referred users (display name or truncated email, signup date, status: pending or confirmed) ### Status transitions A referral has two possible states. Points are awarded when the status transitions from `pending` to `confirmed`: - **pending** -- The user clicked the referral link but has not yet completed signup - **confirmed** -- The user has created a CF ID. Points are awarded to both sides within 60 seconds of confirmation. --- ## Basket Composition The CPI tracks model-family representatives across major providers. Every model family gets one slot, the latest version always, and each model is weighted equally. A model family is a provider's distinct product line (for example `openai.gpt` and `openai.gpt-mini` are different families). The latest released model in each family is its representative; on a new release the representative auto-rolls. The basket is updated with a new version number when basket composition or provider rate-card prices change. [Live data: GET https://api.compute.finance/v1/oracle/basket] --- ## SCU Formula The Standard Compute Unit is calculated in two steps. The reference workload is a fixed token count (published in the `referenceWorkload` field of `GET https://api.compute.finance/v1/oracle/scu`), evaluated across all basket models. The full binding specification, including the exact fixed-point arithmetic, is published at `GET https://api.compute.finance/v1/oracle/methodology` and at the `specUrl` of each methodology record. The SCU is reconstitution-driven. It is published on-chain whenever the basket changes, either because a model is added, removed, or replaced, or because a provider updates a rate-card price. Both triggers produce a new on-chain version. There is no fixed cadence and no continuous off-chain feed. ### Step 1 -- Per-model cost For each model in the basket, compute the cost of the reference workload using the provider's published per-token pricing. Prices are USD per 1M tokens. ``` cost_m = (input_price_m x 0.001) + (output_price_m x 0.0005) ``` **Pricing source.** `GET /v1/oracle/basket` and `GET /v1/oracle/models` return four price numbers per model: - `usdPricePerMillion` -- the provider's list price in USD per 1M tokens, **rounded to 2 decimal places** for display. Not suitable for exact SCU reproduction. - `weiPricePerMillion` -- the same price denominated in `$COMPUTE` per 1M tokens: the attested USD price divided by the peg. - `markedUpUsdPricePerMillion` / `markedUpWeiPricePerMillion` -- that pair with the 5% routing markup, which is what an inference request is charged. The markup never enters the SCU. The peg is the `pegUsd` field of `GET /v1/oracle/pricing` -- no RPC call required, and `usd_price = weiPricePerMillion x peg` converts back. On-chain source: `Treasury.computePriceUsdc()` on Base (contract `0xB77DA11C8eC91D3417aA87072DcDD971A9aF674d`). **Exact reproduction reads the attested manifest, not either rounded field.** `GET /v1/oracle/manifest/{metadataHash}` returns `inputPriceUsd18PerM` and `outputPriceUsd18PerM` per family, in 18-decimal USD, for the revision that `metadataHash` names. ### Step 2 -- Equal-Weight Geometric Mean The SCU is the geometric mean of all N model workload costs, each family weighted equally at 1/N. The Nth-root damping plus the one-family-one-slot rule provide gaming resistance by math — no outlier caps, no governance committee. ``` SCU = (∏ cost_m)^(1/N) for all m in the index ``` The binding arithmetic uses a floor Nth root over integer 18-decimal USD values — defined precisely in the methodology document so any independent re-implementation reproduces the published SCU bit-for-bit. **Methodology versioning.** Every published revision permanently carries the methodology version that produced it (currently v1 = equal-weight geometric mean). The full changelog and per-version definitions are served by `GET /v1/oracle/methodology`; every `/v1/oracle/*` response also carries the `X-Methodology-Version` header reflecting the version in force now. ### Worked Example (exact reproduction) ``` # 1. Fetch the attested manifest and the methodology workload latest = GET /v1/oracle/latest → metadataHash manifest = GET /v1/oracle/manifest/{metadataHash} → families[].{inputPriceUsd18PerM, outputPriceUsd18PerM} methodology = GET /v1/oracle/methodology → entries[0].referenceWorkload # 2. Per-model cost over the reference workload, from 18-decimal USD input_usd_m = family.inputPriceUsd18PerM / 1e18 output_usd_m = family.outputPriceUsd18PerM / 1e18 cost_m = (input_usd_m x 0.001) + (output_usd_m x 0.0005) # 3. Equal-weight geometric mean over N representatives SCU = (∏ cost_m)^(1/N) for all m in the index ``` --- ## Governance The model-family rule reduces governance to a minimum. One eligibility rule, one family rule, one emergency trigger. No weight committees, no tier reviews. | Rule | Specification | Frequency | | ---- | ------------- | --------- | | Listing Criteria | Public GA + first-party USD pricing + in-scope text model + seasoning + liveness. Applied identically to all. | Continuous | | Model Family Rule | One slot per family, latest GA version auto-wins. No governance needed. | Auto | | Edge-Case Review | Published, dated decision for family-vs-version edge cases. Stated reasoning. | As Needed | | Reconstitution | Additions and removals applied by the criteria. Logged. | Scheduled | | Price Updates | Reflected automatically from first-party price cards. Daily scan. | Daily | | Emergency Trigger | Any single model that moves price by more than the set threshold in 24 hours enters a short hold before the change is reflected. | As Needed | **Revision numbering.** The API's `revisionVersion` and `latestRevisionVersion` fields return the on-chain revision counter -- a monotonically incrementing integer starting at 1 with the genesis revision. Each `/v1/oracle/*` response that includes `revisionVersion` reflects the on-chain revision number. The full history is available via the `GET https://api.compute.finance/v1/oracle/reconstitutions` endpoint and exportable as CSV. --- ## On-Chain Verification All CPI pricing is recorded on-chain via the OracleRegistry contract on Base. You can independently verify prices without trusting the Compute Finance API. Contract address, read functions, ethers.js examples, and Basescan verification instructions are maintained at the oracle subdomain: https://oracle.compute.finance/llms-full.txt#on-chain-verification --- ## Public API All oracle endpoints are public and require no authentication. Read access is free and unrestricted. Base URL: `https://api.compute.finance` ### OpenAPI specification The public API contract is published as an OpenAPI 3.x document — auto-generated from the live NestJS controllers, so the spec and the running server cannot drift. Use it to generate typed clients in any language with `openapi-generator`, `openapi-typescript`, `oapi-codegen`, or any other OpenAPI-driven codegen. | URL | Format | Notes | |---|---|---| | `https://api.compute.finance/v1/openapi.yaml` | YAML | Canonical | | `https://api.compute.finance/v1/openapi.json` | JSON | Same spec, JSON encoding | | `https://api.compute.finance/openapi.yaml` | YAML | Conventional alias for agents probing root | | `https://api.compute.finance/openapi.json` | JSON | Conventional alias | | `https://api.compute.finance/openapi` | HTML | Swagger UI for interactive exploration | | `https://api.compute.finance/v1/docs` | HTML | Same Swagger UI, versioned path | All alias URLs return the same byte-identical body — there is exactly one public spec. Public-spec resource endpoints emit a `Link: ; rel="service-desc"; type="text/yaml"` HTTP header (RFC 8631) pointing at the canonical spec. The spec endpoints themselves are reachable cross-origin (`Access-Control-Allow-Origin: *`) so browser-based agents can fetch directly. Cache control: `public, max-age=300, must-revalidate` with weak ETags from Express defaults — refetch periodically to pick up new endpoints when the API ships. **Scope.** The public spec covers read-only Oracle (`/v1/oracle/*`) endpoints — twenty-two routes total. The paid **Inference API** (OpenAI- and Anthropic-compatible chat + messages, plus `/v1/models`, `/v1/models/availability`, `/v1/usage`, `/v1/inference/estimate`) is published as a **separate spec** at [`/v1/openapi.inference.yaml`](https://api.compute.finance/v1/openapi.inference.yaml) with its own Swagger UI at [`/v1/docs/inference`](https://api.compute.finance/v1/docs/inference) and its human reference at [`docs.compute.finance/#inference-api`](https://docs.compute.finance/#inference-api); it is documented in the [Inference API section](#inference-api) below. Wallet-signed account / keys / treasury flows remain internal to first-party UIs. **Discovery.** The OpenAPI URL is also referenced from `llms.txt` and `llms-full.txt` on `compute.finance`, `oracle.compute.finance`, and `docs.compute.finance`, listed once in the docs sitemap, and advertised in the HTML `` of all three UIs as ``. Agents probing any of these surfaces should reach the spec without guessing paths. ### Rate limits The public oracle API is rate-limited to **120 requests per minute per IP** (burst 120). A short-term cap of 5 requests per second and a medium-term cap of 20 requests per 10 seconds also apply to protect the backend. Every admitted response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` headers (from the NestJS Throttler). Clients that exceed the limit receive `429 rate_limited` with a `Retry-After` header giving the seconds to wait — the longest wait when several windows refused — repeated in the body as `details.retryAfterSeconds` beside `details.scope` (`address` for an anonymous caller, whose network address is its only allowance), and with no `X-RateLimit-*` headers. Data updates on reconstitution, so polling more often than once per minute is not useful. **`/v1/points`** — the points and achievements API requires CF ID JWT authentication and is not yet part of the public API surface. It will be documented when publicly available. ### V1 scope -- what is not shipping V1 does not ship a first-party typed SDK -- use the OpenAPI spec at `https://api.compute.finance/v1/openapi.yaml` to generate clients with `openapi-generator`, `openapi-typescript`, or `oapi-codegen`. ### Compute Finance MCP Compute Finance ships an official MCP server for AI agent tool use. Transport: stdio (local process, no hosted endpoint). The public and local tools need no API key and no account. Every tool here is free — none of them sends an inference request. Claude Code — one command registers the server, its slash skills and a hook that reports what each session cost: ``` npx @compute-finance/mcp setup ``` Any other MCP client — add the server to the client's own configuration: ```json { "command": "npx", "args": ["@compute-finance/mcp"] } ``` Every tool carries one of these prefixes: - **Public data**, no account needed: `data_get_*` — live oracle data (SCU and CPI, basket, catalogue, model prices and their history, reconstitutions, methodology, model availability); `compute_*` — cost estimation and cross-model comparison. - **Local sessions**, read on this machine and priced at live oracle rates, nothing uploaded: `render_*` — pre-formatted session reports used by the Claude Code skills; `analyze_*` — raw JSON session and per-inference breakdown; `telemetry_get_*` — aggregate stats across logged sessions. - **Your account**, registered only once an account is connected, and only the tools its grant allows: `account_*` — with Read access, balance, spend, keys and history; with Act access, also create an API key, freeze or unfreeze a key, set budget caps and configure auto top-up, which charges the caller's saved card and is always set on the caller's own personal account, even when the grant is pinned to an organization. Act tools change the account. No grant can take money out of the account: withdrawals, transfers and anything that needs a wallet signature stay with the wallet. Connect an account: 1. In [Settings](https://compute.finance/settings) → Connected apps, press Grant access, name the app and tick Read, Act or both; in an organization, pick the account the grant is pinned to. Copy the `cfa_live_…` token — it is shown once. 2. Run `npx @compute-finance/mcp setup --account` and paste the token. Typing is hidden and the token is never a command argument. It is kept in the OS secret store (macOS Keychain, Windows DPAPI, Linux Secret Service). 3. Restart the MCP client — the `account_*` tools the grant allows do not appear until you do. To keep the token in a password manager instead, set `CF_APP_GRANT_COMMAND` to a command that prints it, e.g. `op read op://Private/compute-finance/token`; the server runs it at startup before looking in the OS secret store. Revoke a grant in Settings → Connected apps, then run `npx @compute-finance/mcp setup --forget-account` to remove the stored token; a frozen grant can be unfrozen there, so keep the stored token while the grant is only frozen. Either way the public and local tools keep working. Docs: https://docs.compute.finance/#mcp Repository: https://github.com/compute-finance/mcp NPM: https://www.npmjs.com/package/@compute-finance/mcp --- ## Endpoints Paths are against `https://api.compute.finance`; `{key}`, `{revision}`, `{iso8601}` are RFC 6570 placeholders. Oracle responses identify a model by the canonical `vendor/model` id — the same id the Inference API routes on. The `{key}` path segment accepts that id (percent-encode the separator: `openai%2Fgpt-5.5`) or the bare model name; an unknown vendor is a `422 validation_failed`. Provenance strings stay verbatim: `familyRepresentatives[].modelKey`, the manifest, the revision basket, and the reconstitution log all keep the bare key the on-chain hashes cover, and `price-at` / `price-history` echo it as `manifestKey` whenever they answer from a manifest. | Method | Path | Description | |---|---|---| | GET | `/v1/oracle/scu` | Current SCU value, reference workload, methodology version | | GET | `/v1/oracle/models` | Catalog: basket models plus retired ex-members (`inBasket`, `retiredAtRevision`); retired models priced from the live catalog. Provider list prices, plus the marked-up pair | | GET | `/v1/oracle/models/{key}` | Single catalog model (basket member or retired) by model id | | GET | `/v1/oracle/catalog` | Every tracked model with current price and index-member flag. Provider list prices, no routing markup | | GET | `/v1/oracle/resolve/{key}` | Resolve one model name to its canonical `vendor/model` id, prices and `priceSource` | | GET | `/v1/oracle/resolve?keys={csv}` | Resolve up to 100 comma-separated names in one call, input order preserved; every key is isolated, so a name the single form would refuse with `422` — an unknown vendor included — comes back as an `off-basket` entry instead of failing the batch | | GET | `/v1/oracle/models/{key}/price-at?date={iso8601}` | Per-model input/output USD price effective at the requested timestamp (`source: "manifest"` for basket members, `source: "catalog"` otherwise) | | GET | `/v1/oracle/basket` | Full basket composition (models + SCU value + routing fee + revision/methodology version) | | GET | `/v1/oracle/history?from={iso8601}&to={iso8601}&granularity={per-revision\|daily\|weekly}&limit={int}` | SCU index time series; `Accept: text/csv` returns a CSV attachment | | GET | `/v1/oracle/models/{key}/price-history?from={iso8601}&to={iso8601}&granularity={per-revision\|daily\|weekly}&limit={int}` | Per-model input/output USD price time series; `Accept: text/csv` returns a CSV attachment | | GET | `/v1/oracle/reconstitutions` | History of basket reconstitutions with version, models, SCU delta | | GET | `/v1/oracle/revisions/{revision}` | Full OracleRevision record for a specific on-chain revision | | GET | `/v1/oracle/health` | Latest confirmed revision version and confirmation timestamp | | GET | `/v1/oracle/contract-metadata` | Live OracleRegistry identity — chainId, proxy address, on-chain `version()`, and `keccak256` of the deployed bytecode | | GET | `/v1/oracle/baseline` | Frozen SCU of the first confirmed revision — denominator for the inverse `computeIndex` purchasing-power view | | GET | `/v1/oracle/scu-at?date={iso8601}` | SCU value active at a given timestamp — step-function lookup of the latest confirmed revision with `publishedAt ≤ date` | | GET | `/v1/oracle/latest` | Latest confirmed revision summary (version, SCU, basket size) | | GET | `/v1/oracle/stats` | Aggregate protocol statistics | | GET | `/v1/oracle/activity?limit=50&offset=0` | Paginated activity feed | | GET | `/v1/oracle/pricing` | Per-model pricing **as billed** — every figure carries the routing markup, cache and reasoning included | | GET | `/v1/oracle/methodology` | Active methodology version + full changelog | | GET | `/v1/oracle/methodology/{version}` | Single methodology record (formula, reference workload, family rule, spec URL) | | GET | `/v1/oracle/manifest/{metadataHash}` | Content-addressed manifest for a confirmed revision (`metadataHash` = JCS+keccak256 of the whole document; `contentHash` = of the price projection) | | GET | `/v1/oracle/reconstitutions/export` | Reconstitution history as downloadable markdown | Every `/v1/oracle/*` response carries the `X-Methodology-Version` header reflecting the methodology version in force at request time. **`/v1/oracle/models` vs `/v1/oracle/basket`**: The `/models` endpoint returns the catalog array — current basket members (`inBasket: true`) plus retired ex-members (`inBasket: false`, `retiredAtRevision` set, priced from the live catalog). The `/basket` endpoint returns only current members PLUS basket-level metadata: SCU value in USD, routing fee rate, revision version, methodology version, and last-updated timestamp. --- ## Code Examples All endpoints are public. No authentication required. ### Get Current SCU **cURL** ```bash curl https://api.compute.finance/v1/oracle/scu ``` **Python** ```python import requests resp = requests.get("https://api.compute.finance/v1/oracle/scu") data = resp.json() print(f"SCU: {data['scuUsd']}") ``` **TypeScript** ```typescript const resp = await fetch("https://api.compute.finance/v1/oracle/scu"); const data = await resp.json(); console.log(`SCU: ${data.scuUsd}`); ``` ### List All Models **cURL** ```bash curl https://api.compute.finance/v1/oracle/models ``` **Python** ```python import requests resp = requests.get("https://api.compute.finance/v1/oracle/models") data = resp.json() for model in data["models"]: print(f"{model['displayName']} ({model['family']})") ``` **TypeScript** ```typescript const resp = await fetch("https://api.compute.finance/v1/oracle/models"); const data = await resp.json(); for (const model of data.models) { console.log(`${model.displayName} (${model.family})`); } ``` ### Get Single Model **cURL** ```bash curl https://api.compute.finance/v1/oracle/models/claude-opus-5 ``` **Python** ```python import requests resp = requests.get("https://api.compute.finance/v1/oracle/models/claude-opus-5") model = resp.json() print(f"{model['displayName']}: ${model['usdPricePerMillion']['input']}/1M input") ``` **TypeScript** ```typescript const resp = await fetch("https://api.compute.finance/v1/oracle/models/claude-opus-5"); const model = await resp.json(); console.log(`${model.displayName}: $${model.usdPricePerMillion.input}/1M input`); ``` ### Historical SCU (date range) **cURL** ```bash curl "https://api.compute.finance/v1/oracle/history?from=2026-05-18T00:00:00Z&to=2026-06-18T00:00:00Z&granularity=daily" curl -H "Accept: text/csv" "https://api.compute.finance/v1/oracle/history?from=2026-05-18T00:00:00Z&to=2026-06-18T00:00:00Z&granularity=daily" -o scu-history.csv ``` **Python** ```python import requests resp = requests.get( "https://api.compute.finance/v1/oracle/history", params={"from": "2026-05-18T00:00:00Z", "to": "2026-06-18T00:00:00Z", "granularity": "daily"}, ) data = resp.json() for point in data["data"]: print(f"{point['date']}: SCU={point['scuUsd']} (revision {point['revisionVersion']})") ``` **TypeScript** ```typescript const resp = await fetch( "https://api.compute.finance/v1/oracle/history?from=2026-05-18T00:00:00Z&to=2026-06-18T00:00:00Z&granularity=daily", ); const data = await resp.json(); for (const point of data.data) { console.log(`${point.date}: SCU=${point.scuUsd} (revision ${point.revisionVersion})`); } ``` --- ## Response Schemas Paths are against `https://api.compute.finance`; `{revision}` and `{iso8601}` are RFC 6570 placeholders. ### `GET /v1/oracle/scu` The live SCU value, reference workload, active methodology version, and the per-family breakdown. The `breakdown` field is a discriminated union keyed by `methodologyVersion`: under v1 it carries the list of family representatives, each with the family key, model key, USD-per-million-token input/output prices, and the blended cost over the reference workload. The empty-basket case returns `204 No Content`. Example values are illustrative — fetch the live endpoint for current numbers. ```json { "scuUsd": 0.003301944577548741, "computeIndex": 73.73384151088473, "referenceWorkload": { "inputTokens": 1000, "outputTokens": 500 }, "methodologyVersion": 1, "breakdown": { "methodologyVersion": 1, "familyRepresentatives": [ { "family": "openai.gpt", "modelKey": "gpt-5.5", "inputPriceUsdPerMillion": 5.0, "outputPriceUsdPerMillion": 30.0, "blendedCostUsd": 0.02 } ] }, "updatedAt": "2026-08-27T15:35:16.947Z" } ``` `computeIndex` is the inverse purchasing-power index `(baseline / scuUsd) × 100`, a display/foundation-grade derived field — `100` at genesis, rises as compute gets cheaper, falls as it gets more expensive. The baseline denominator is published at `/v1/oracle/baseline` and frozen at the first confirmed revision's SCU. `null` only when the baseline has not been published yet. `$COMPUTE` is that index: `OracleRegistry.getComputeIndex()` publishes the same reading on-chain in 18 decimals, and the peg `Treasury.computePriceUsdc()` follows it — scaled to USDC's six decimals and rewritten once the two drift more than 10 basis points apart — so one `$COMPUTE` is worth the index reading in USDC. `GET /v1/oracle/pricing` serves it off-chain as `pegUsd`, and every inference charge is a USD cost divided by it. ### `GET /v1/oracle/models` The full list of basket models. The response is a top-level `models` array; each entry carries the model identity, family, integration status, both list and marked-up per-million pricing in $COMPUTE and USD, and per-model `cache` / `reasoning` multiplier blocks. `usdPricePerMillion` and the multiplier blocks are the vendor's own list prices; only `markedUpUsdPricePerMillion` / `markedUpWeiPricePerMillion` carry the routing markup, and `GET /v1/oracle/pricing` publishes every kind that way. The multiplier blocks are catalog/metering data — they do not enter the SCU formula. Example values are illustrative. ```json { "models": [ { "id": "openai/gpt-5.5", "displayName": "GPT-5.5", "provider": { "key": "openai", "name": "OpenAI" }, "family": "openai.gpt", "weiPricePerMillion": { "input": 0.06781146800693592, "output": 0.4068688080416155 }, "usdPricePerMillion": { "input": 5, "output": 30 }, "markedUpWeiPricePerMillion": { "input": 0.07120204140728272, "output": 0.42721224844369626 }, "markedUpUsdPricePerMillion": { "input": 5.25, "output": 31.5 }, "releasedAt": "2026-04-23T00:00:00.000Z", "cache": { "cachedInput": { "usdPerMillion": 0.5, "ratioOfInput": 0.1, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:16:10.984Z" }, "cacheWrite5m": null, "cacheWrite1h": null, "read_multiplier": 0.1, "write_multiplier_5m": null, "write_multiplier_1h": null }, "reasoning": { "reasoningOutput": { "usdPerMillion": 30, "ratioOfInput": 6, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:16:10.984Z" } }, "inBasket": true, "retiredAtRevision": null } ] } ``` **Field: `releasedAt`** -- ISO 8601 timestamp of the model's public release; `null` if unknown. **Field: `cache`** -- cached-input + cache-write multiplier block; each entry carries both `usdPerMillion` and `ratioOfInput`, plus flat `read_multiplier` / `write_multiplier_5m` / `write_multiplier_1h` shortcuts at the block level. `null` when the model has no cache multiplier data. **Field: `reasoning`** -- reasoning-output multiplier block; `null` when the provider bills thinking tokens at the standard output rate (no distinct reasoning surcharge). Each `cache` / `reasoning` component carries a `provenance` mark of its own; the model's own `usdPricePerMillion` pair carries none here, because for a basket member it is the manifest-attested figure and for a retired ex-member it is the live-catalog figure — read `GET /v1/oracle/catalog` or `GET /v1/oracle/resolve` for the catalog's mark on a model's input and output. Both blocks are served from the live catalog (`source: "catalog"`, `sourceUrl: null`) and are never attested on-chain -- the manifest carries basket `input`/`output` only. `createdAt` is the catalog observation time, or `null` when it is unknown. ### `GET /v1/oracle/basket` Full basket composition: models array plus SCU value, routing fee rate, revision/methodology version, and last-updated timestamp. ```json { "models": [ { "id": "anthropic/claude-opus-5", "displayName": "Claude Opus 5", "provider": { "key": "anthropic", "name": "Anthropic" }, "family": "anthropic.claude-opus", "weiPricePerMillion": { "input": 0.06781146800693592, "output": 0.33905734003467963 }, "usdPricePerMillion": { "input": 5, "output": 25 }, "markedUpWeiPricePerMillion": { "input": 0.07120204140728272, "output": 0.3560102070364136 }, "markedUpUsdPricePerMillion": { "input": 5.25, "output": 26.25 }, "releasedAt": "2026-07-24T00:00:00.000Z", "cache": { "cachedInput": { "usdPerMillion": 0.5, "ratioOfInput": 0.1, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:15:58.070Z" }, "cacheWrite5m": { "usdPerMillion": 6.25, "ratioOfInput": 1.25, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:15:58.070Z" }, "cacheWrite1h": { "usdPerMillion": 10, "ratioOfInput": 2, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:15:58.070Z" }, "read_multiplier": 0.1, "write_multiplier_5m": 1.25, "write_multiplier_1h": 2 }, "reasoning": { "reasoningOutput": { "usdPerMillion": 25, "ratioOfInput": 5, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:15:58.070Z" } } } ], "scuUsd": 0.003301944577548741, "routingFeeRate": 0.05, "revisionVersion": 6, "methodologyVersion": 1, "lastUpdated": "2026-08-27T15:35:16.947Z" } ``` ### `GET /v1/oracle/history?from={iso8601}&to={iso8601}&granularity={per-revision|daily|weekly}&limit={int}` SCU index time series over the requested range. `granularity` defaults to `per-revision`; `daily` and `weekly` buckets carry the last revision's value forward across empty buckets (step-function close). `limit` caps the series at 10000 points; oldest points are dropped first and `truncated: true` is set. Each point carries the revision and methodology version active at that bucket plus the `metadataHash` of the revision that produced it -- fetch `GET /v1/oracle/manifest/{metadataHash}` to verify the per-family breakdown for that point. Set `Accept: text/csv` to download a spreadsheet-friendly CSV with columns `date,scuUsd,computeIndex,revisionVersion,methodologyVersion,metadataHash` instead of JSON. ```json { "from": "2026-06-19T15:57:41.000Z", "to": "2026-07-06T08:37:17.000Z", "granularity": "per-revision", "count": 2, "truncated": false, "data": [ { "date": "2026-06-19T15:57:41.000Z", "scuUsd": 0.002434650581587041, "computeIndex": 100, "revisionVersion": 1, "methodologyVersion": 1, "metadataHash": "0x7ef3..." }, { "date": "2026-07-06T08:37:17.000Z", "scuUsd": 0.002742184351464414, "computeIndex": 88.78508041543085, "revisionVersion": 2, "methodologyVersion": 1, "metadataHash": "0x467d..." } ] } ``` ### `GET /v1/oracle/models/{key}/price-history?from={iso8601}&to={iso8601}&granularity={per-revision|daily|weekly}&limit={int}` Input/output USD-per-million-token price time series. Every point carries a `source`. For a model that has appeared in at least one confirmed revision's basket the series is manifest-sourced (`source: "manifest"`, each point cross-linking `revisionVersion` / `methodologyVersion` / `metadataHash`), with the same range, granularity, limit, and `Accept: text/csv` semantics as `/v1/oracle/history`; `family` echoes the family slot the model occupies in its most recent appearance, and catchup revisions whose manifest is not yet available are surfaced in `unavailableRevisions`. Any other tracked model falls back to the live catalog's temporal history — `source: "catalog"`, one point per price change, `unavailableRevisions: []`, and `family` may be `null`. Models with neither a basket appearance nor a catalog price return `404 not_found`. ```json { "modelKey": "openai/gpt-5.5", "manifestKey": "gpt-5.5", "family": "openai.gpt", "from": "2026-06-19T15:57:41.000Z", "to": "2026-07-06T08:37:17.000Z", "granularity": "per-revision", "count": 2, "truncated": false, "unavailableRevisions": [], "data": [ { "date": "2026-06-19T15:57:41.000Z", "inputPriceUsdPerMillion": 5, "outputPriceUsdPerMillion": 30, "source": "manifest", "revisionVersion": 1, "methodologyVersion": 1, "metadataHash": "0x7ef3..." }, { "date": "2026-07-06T08:37:17.000Z", "inputPriceUsdPerMillion": 5, "outputPriceUsdPerMillion": 30, "source": "manifest", "revisionVersion": 2, "methodologyVersion": 1, "metadataHash": "0x467d..." } ] } ``` ### `GET /v1/oracle/catalog` Display/reporting-grade catalog of every tracked model. Each entry carries identity, provider, family, the `indexMember` flag (`true` when the model is the current family representative in the latest confirmed revision's manifest), the current input/output USD price per million tokens with the `observedAt` timestamp from the underlying live-catalog (`ModelPrice`) row, and the per-model `cache` / `reasoning` blocks when present. Models without a live catalog price are excluded. The series is capped at 1000 entries; if exceeded, oldest are dropped and `truncated: true` is set. `Cache-Control: public, max-age=60`. **Field: `sdkId`** — the id this model answers to at its own vendor, which is what a request carries upstream. It differs from the name in `modelKey` wherever the vendor spells its model differently: `anthropic/claude-opus-5.5` is `claude-opus-5-5` at Anthropic. Name a model to the Inference API by its `modelKey`, never by this. **Field: `contextTiers`** — long-context price ladder, ascending by `fromInputTokens`, present only on models that carry one; a flat-priced model omits the field entirely and costs the same at every input size. `fromInputTokens` is the lowest input size priced at that tier, selected from the whole input side of a request — prompt plus cache reads plus cache writes — with a half-open range, so an input landing exactly on a threshold takes that tier rather than the one below. `currentPrice` is the flat rate charged below the first threshold, and it is the only price the SCU manifest attests: a context tier never enters the index. To price a specific request rather than read the ladder yourself, call `GET /v1/inference/estimate` — its `tierFromInputTokens` names the tier the bill will use. **Field: `provenance`** — how far a number has been checked. It rides on the number, not the model: `currentPrice.provenance` marks the flat input and output separately, each rung of `contextTiers` carries its own mark, and every component of `cache` / `reasoning` carries one too, so a model can be `promotional` at its flat rate, `verified` above a context threshold and `inferred` on a cache component at the same time. Three values: | Value | Means | How much to trust it | |---|---|---| | `verified` | an operator recorded a vendor source for this number | Backed by a source someone read. It is still the operator's claim as of their last pass, not a live check. | | `inferred` | derived from a sibling number or a vendor default, with no source recorded | A working estimate. Treat a cost projection built on it as approximate. | | `promotional` | a discounted list price that bills exactly as shown and is expected to end | Correct today. No end date is stored, so it will stop being correct without the number moving — re-read it before pricing anything long-lived. | Marks are set by hand and hold as of the operator's last pass rather than as a live check against the vendor: a number that went on promotion and has not been re-marked still reads as it was. Every value bills exactly as shown: the mark says how much to trust a number, never what it costs. The mark is catalogue data and never enters the SCU manifest or its hashes, so an attested revision is byte-identical whether or not a number is marked. ```json { "models": [ { "modelKey": "openai/gpt-5.5", "displayName": "GPT-5.5", "provider": { "key": "openai", "name": "OpenAI" }, "sdkId": "gpt-5.5", "family": "openai.gpt", "indexMember": true, "releasedAt": "2026-01-15T00:00:00.000Z", "currentPrice": { "inputPriceUsdPerMillion": 1.25, "outputPriceUsdPerMillion": 10.0, "provenance": { "input": "promotional", "output": "verified" }, "observedAt": "2026-06-10T08:30:00.000Z" }, "contextTiers": [ { "fromInputTokens": 200000, "inputPriceUsdPerMillion": 2.5, "outputPriceUsdPerMillion": 20.0, "provenance": "verified" } ], "cache": null, "reasoning": null } ], "truncated": false, "generatedAt": "2026-06-17T12:34:56.789Z" } ``` ### `GET /v1/oracle/models/{key}/price-at?date={iso8601}` Per-model input/output USD price effective at the requested timestamp. The response is a discriminated union keyed by `source`: `"manifest"` when the model is the family representative in the revision active at that date (cross-links `revisionVersion`, `methodologyVersion`, `metadataHash`, and `family` so a caller can fetch and verify the full manifest), or `"catalog"` when the model was not a basket member at that date — the answer then comes from the live catalog's temporal history (step-function: the `ModelPrice` range covering the date), and `family` may be `null`. `observedAt` reflects when the price was recorded, not request time. Returns `422 validation_failed` if the date is malformed or in the future, `404 not_found` for untracked models, and `404 not_found` when neither the attested manifest nor the live catalog has a price at that date. `Cache-Control: public, max-age=60`. ```json { "source": "manifest", "modelKey": "openai/gpt-5.5", "manifestKey": "gpt-5.5", "date": "2026-06-15T12:00:00Z", "inputPriceUsdPerMillion": 1.25, "outputPriceUsdPerMillion": 10.0, "observedAt": "2026-06-11T10:00:00.000Z", "revisionVersion": 7, "methodologyVersion": 1, "metadataHash": "0x38551a40...", "family": "openai.gpt" } ``` ### `GET /v1/oracle/methodology` Active methodology version and the full changelog. Each entry pins the formula identity, family rule, reference workload, and `specUrl` of the published methodology document. ```json { "activeVersion": 1, "entries": [ { "version": 1, "title": "Equal-weight geometric mean of model-family representatives", "meanType": "geometric", "weighting": "equal-1-over-n", "familyRule": { "oneFamilyOneSlot": true, "familyKeyScheme": "provider.product-line", "representativeSelection": "latest-published-then-highest-revision" }, "referenceWorkload": { "inputTokens": 1000, "outputTokens": 500 }, "cacheReasoningInIndex": false, "formulaSummary": "SCU = (∏ cost_m)^(1/N) for all m in the index, equal weight 1/N; cost_m = inputUsdPerM × 0.001 + outputUsdPerM × 0.0005 in USD — no tiers, no provider weights, no outlier cap", "rationale": "Every model family counts equally toward the price: the Nth-root damping of the geometric mean plus the one-family-one-slot rule provide gaming resistance without tier weights or governed caps", "specUrl": "https://docs.compute.finance/methodology" } ] } ``` ### `GET /v1/oracle/revisions/{revision}` Full OracleRevision record for a specific on-chain revision. ```json { "revisionVersion": 1, "methodologyVersion": 1, "publishedAt": "2026-06-19T15:57:41.000Z", "publishedBlock": 31200000, "txHash": "0xabc…", "scuUsd": 0.002434650581587041, "scuUsd18": "2434650581587041", "basketSize": 18, "basket": { "schemaVersion": 1, "models": [ { "modelKey": "gpt-5.5", "family": "openai.gpt", "inputPrice": "67811468006935924", "outputPrice": "406868808041615515", "displayName": "GPT-5.5", "providerKey": "openai", "sdkId": "gpt-5.5" } ] }, "status": "CONFIRMED", "confirmedAt": "2026-06-19T15:57:41.726Z", "manifestUrl": "/v1/oracle/manifest/0x…" } ``` ### `GET /v1/oracle/reconstitutions` Reconstitution event log with per-event change details. ```json { "entries": [ { "id": "recon-1", "revisionVersion": 1, "previousVersion": null, "publishedAt": "2026-06-19T15:57:41.000Z", "methodologyVersion": 1, "summary": "Inception with 18 families", "scuBefore": null, "scuAfter": 0.002434650581587041, "changes": [ { "type": "ModelAdded", "modelKey": "gpt-5.5", "description": "Added gpt-5.5 to the basket" }, { "type": "ModelAdded", "modelKey": "claude-opus-5", "description": "Added claude-opus-5 to the basket" } ], "txHash": "0xabc123..." } ] } ``` ### `GET /v1/oracle/health` Latest revision version and confirmation timestamp. `stale` is `true` if the last oracle sync is older than the configured threshold. `liveModelCount` is the size of the in-memory basket snapshot (`null` when none is loaded) and `emptyBasket` is `true` when that snapshot holds no model; `basketRevisionVersion` is the revision that snapshot came from. `pendingRevision` carries `{ ageMs }` while a publish has been broadcast and is still awaiting on-chain confirmation, and `null` otherwise -- the field never leaks the pending revision's version, contentHash, or txHash. ```json { "latestRevisionVersion": 6, "methodologyVersion": 1, "latestRevisionConfirmedAt": "2026-08-03T08:01:11.913Z", "lastSyncAt": "2026-08-27T15:15:15.207Z", "stale": false, "liveModelCount": 22, "emptyBasket": false, "basketRevisionVersion": 6, "pendingRevision": null } ``` ### `GET /v1/oracle/contract-metadata` Live identity read of the deployed `OracleRegistry` proxy. The backend reads the contract's on-chain `version()` and the `keccak256` of the deployed bytecode (`eth_getCode` then hashed) over the standard RPC the backend already uses for sync and publish. `bytecodeHash` is `null` when the contract has no deployed code or when the RPC call fails. Backend caches the response for five minutes; `Cache-Control: public, max-age=300`. Role membership is not exposed: the deployed `OracleRegistry` uses `AccessControl` without the `Enumerable` extension, so holders cannot be enumerated through the contract ABI — query the chain directly (BaseScan, event index) to inspect role grants. ```json { "chainId": 8453, "address": "0x1b91c0961928a14a2eD6c1985bC11aF1b302714D", "version": 1, "bytecodeHash": "0x9c5b0e1a8b9d7e2a3c1d4f5e6a7b8c9d0e1f2a3b4c5d6e7f8091a2b3c4d5e6f7", "checkedAt": "2026-06-19T11:00:00.000Z" } ``` ### `GET /v1/oracle/baseline` The frozen SCU denominator for the inverse `computeIndex` purchasing-power view: the SCU of the first confirmed revision (methodologyVersion 1), captured set-once and never changes. The index reads `100` at genesis and rises as compute gets cheaper. Returns 204 No Content if no confirmed revision exists yet. ```json { "date": "2026-06-19", "scuUsd": 0.002434650581587041, "methodologyVersion": 1 } ``` ### `GET /v1/oracle/scu-at?date={iso8601}` SCU value active at a given timestamp — a step function over the confirmed revision series. Resolves the latest revision with `publishedAt ≤ date` and returns its SCU, methodology version, revision version, publish timestamp, and metadataHash. When two confirmed revisions share `publishedAt` the highest `revisionVersion` wins (monotonicity is non-strict). `date` must be a full ISO-8601 instant with timezone offset. Responses: - **200** — JSON with the active revision and the derived `computeIndex` (same `(baseline.scuUsd / scuUsd) × 100` formula as `/v1/oracle/scu` and `/v1/oracle/history`). - **204** — `date` precedes the genesis revision. - **422** — `date` is in the future, malformed, or missing the time component. ```json { "at": "2026-06-20T12:00:00.000Z", "scuUsd": 0.002434650581587041, "scuUsd18": "2434650581587041", "computeIndex": 100, "revisionVersion": 1, "methodologyVersion": 1, "publishedAt": "2026-06-19T15:57:41.000Z", "metadataHash": "0x7ef31525a6edfa2fa7f36ffec40c885343eca392a2ea451f17f95573198d777b" } ``` ### `GET /v1/oracle/latest` Lightweight summary of the latest confirmed revision — no full basket payload. Returns 204 No Content if no confirmed revision exists yet. ```json { "revisionVersion": 6, "methodologyVersion": 1, "publishedAt": "2026-08-03T08:01:11.000Z", "confirmedAt": "2026-08-03T08:01:11.913Z", "scuUsd": 0.003301944577548741, "computeIndex": 73.73384151088473, "basketSize": 22, "workload": { "inputTokens": 1000, "outputTokens": 500 }, "metadataHash": "0xab10a5e3b63e4fed4cb54c6645da4bf1072bb26634b703355068e519edfc6234" } ``` ### `GET /v1/oracle/pricing` Per-model pricing **as billed**, in both $COMPUTE per million tokens and USD. Every figure already carries the 5% routing markup, `cache` and `reasoning` components included, so it matches what a request is charged — `GET /v1/oracle/models` and `GET /v1/oracle/catalog` publish the same models at the vendors' list prices without it. `pegUsd` is the current $COMPUTE price in USDC, and `usdPerMillion = weiPerMillion x pegUsd`. `cache` / `reasoning` blocks carry the same multiplier shape as on `/v1/oracle/models`; `null` when the model has no multiplier data for that block. Every figure here is read from the live catalog, so the `input` and `output` legs each carry their own `provenance` mark and so does every `cache` / `reasoning` component — the same three values defined under `GET /v1/oracle/catalog` above. A mark records where a number came from; it never changes the number, so it never changes the bill. ```json { "object": "pricing", "pegUsd": 73.733841, "models": { "openai/gpt-5.5": { "input": { "weiPerMillion": 0.071202, "usdPerMillion": 5.25, "provenance": "verified" }, "output": { "weiPerMillion": 0.427212, "usdPerMillion": 31.5, "provenance": "verified" }, "cache": { "cachedInput": { "usdPerMillion": 0.525, "ratioOfInput": 0.1, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:16:10.984Z" }, "cacheWrite5m": null, "cacheWrite1h": null, "read_multiplier": 0.1, "write_multiplier_5m": null, "write_multiplier_1h": null }, "reasoning": { "reasoningOutput": { "usdPerMillion": 31.5, "ratioOfInput": 6, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:16:10.984Z" } } } }, "updatedAt": "2026-08-27T14:35:11.046Z" } ``` ### `GET /v1/oracle/resolve/{key}` Resolves one model name to its canonical `vendor/model` id, its catalogue prices and the source those prices came from. Reads the optional vendor prefix (percent-encode the separator: `openai%2Fgpt-5.5`), then normalizes the name — dash to dot, bracket annotations and trailing date suffixes stripped — and matches against the catalogue, narrowed to that vendor when one is named. `priceSource` is `oracle-basket` (current index member), `oracle-catalog` (priced but not a current member) or `off-basket` (not in the catalogue). An unknown model is `200` with `off-basket` and null prices, never `404`; an unknown vendor is `422`. `Cache-Control: public, max-age=60`. ```json { "inputKey": "gpt-5.5", "resolvedKey": "openai/gpt-5.5", "family": "openai.gpt", "provider": { "key": "openai", "name": "OpenAI" }, "prices": { "inputUsdPerMillion": 5, "outputUsdPerMillion": 30, "provenance": { "input": "verified", "output": "verified" } }, "cache": { "cachedInput": { "usdPerMillion": 0.5, "ratioOfInput": 0.1, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:16:10.984Z" }, "cacheWrite5m": null, "cacheWrite1h": null, "read_multiplier": 0.1, "write_multiplier_5m": null, "write_multiplier_1h": null }, "reasoning": { "reasoningOutput": { "usdPerMillion": 30, "ratioOfInput": 6, "source": "catalog", "sourceUrl": null, "provenance": "verified", "createdAt": "2026-08-26T15:16:10.984Z" } }, "inBasket": true, "priceSource": "oracle-basket" } ``` ### `GET /v1/oracle/resolve?keys={csv}` Matches each comma-separated key the way `/resolve/{key}` does, preserving input order under a top-level `results` array. Every key is isolated: anything unresolvable returns `priceSource: "off-basket"` with null prices rather than failing the batch — including an unknown vendor, which the single form refuses with `422`. Batch size is capped at 100. --- ## Inference API Paid, OpenAI- and Anthropic-compatible inference over pooled provider capacity or an admitted private endpoint, billed against `$COMPUTE` held in BuyerEscrow — a catalogue model at the metered rate published by the Oracle, a supplier's model at the price version its pool accepted. This is a **separate product** from the free Oracle API above and is published as its own OpenAPI spec. **Machine surface.** - YAML — https://api.compute.finance/v1/openapi.inference.yaml - JSON — https://api.compute.finance/v1/openapi.inference.json - Swagger UI — https://api.compute.finance/v1/docs/inference - Get a key — https://compute.finance/dashboard/api-keys ### First request Two things have to exist before any snippet works: an account and a balance on it. Signing in by email or by wallet creates the account — see **Compute Finance ID**. Its `$COMPUTE` balance is topped up at https://compute.finance/dashboard/ai-balance by card, by swapping USDC from a connected wallet, or in stablecoins (USDC, USDT or USDe) under Add funds → Stablecoins. From there to an answer: issue a key at https://compute.finance/dashboard/api-keys, then run the cURL or the Python snippet with the key in place of `ct_live_...`. cURL needs nothing installed; the Python one is the official `openai` client with its base URL pointed here and everything else unchanged. The snippets name a model as `vendor/model`; how that name is formed, what `auto` does instead, and what the answer costs are under **Integration contracts** below. **cURL.** ```bash curl https://api.compute.finance/v1/chat/completions \ -H "Authorization: Bearer ct_live_..." \ -H "Content-Type: application/json" \ -d '{"model":"openai/gpt-5.5","messages":[{"role":"user","content":"Hello"}]}' ``` **Python (openai SDK, pinned to 2.45).** ```python from openai import OpenAI client = OpenAI( base_url="https://api.compute.finance/v1", api_key="ct_live_...", ) resp = client.chat.completions.create( model="openai/gpt-5.5", messages=[{"role": "user", "content": "Hello"}], ) print(resp.choices[0].message.content) ``` ### API keys Keys are issued from the account's API keys page — https://compute.finance/dashboard/api-keys. Issuance is free and never checks the balance, and every field on the form is optional — a key created with nothing filled in works. Its label and its spending caps stay editable afterwards. The raw key is returned exactly once, at creation. Only its SHA-256 hash is stored, so nothing can show it again. From then on the list identifies each key by the short `keyPrefix` it returns: enough to tell two keys apart, useless as a credential. A lost key is replaced, not recovered — revoke it and issue another. Freezing a key is reversible from the same page, as often as needed. Revoking is permanent: a revoked key can be neither restored nor edited, and it stays in the list only as a record. A state change binds from the next request onward — a request already streaming runs to its end. What each state returns is under **Base URL and Authentication**. A key can be held to a subset of the catalogue: name the models under `allowedModels` when you issue it, and change the list later from the same page. The list replaces the previous one whole, and an empty list lifts the restriction. Each entry names a catalogue model by its `vendor/model` id or by the vendor's own SDK id and is stored as the `vendor/model` id; a spelling the catalogue does not hold is refused with `422 validation_failed` naming it, and at most 50 entries survive once duplicate spellings collapse. A key bound to a private pool can also name, by its `handle/alias` id, a model the pool admits from a supplier's offer — the ids `GET /v1/models` lists under that key; any other `handle/alias` is refused the same way. The catalogue is a superset of `GET /v1/models`, so a model can be allowed before it is listed there. A request naming a model outside the list returns `403 model_restricted` — it is never routed to a model the key may reach instead. Balance is held on the account, not on the key: every key of an account spends the same `$COMPUTE` balance, and a key's daily and monthly caps only bound that key's share of it (`429 spending_limit_reached` on exceeding one), and a request in flight counts against them at its reserved amount until it settles. Because issuance never checks the balance, a new key on an unfunded account authenticates and then fails its first request with `402 insufficient_balance` — top the account up at https://compute.finance/dashboard/ai-balance first. ### Base URL and Authentication Base URL: `https://api.compute.finance`. Auth: `Authorization: Bearer ct_live_<...>` on every endpoint. `POST /v1/messages`, `GET /v1/models`, `GET /v1/models/availability` and `GET /v1/inference/estimate` additionally accept `x-api-key: ct_live_<...>` so the official `@anthropic-ai/sdk` works with only a base-URL swap (its default auth header is `x-api-key`). Key state → response: - `active` → normal responses. - `frozen` → `403 api_key_frozen`. Suspended by its holder or by an operator; reversible. - `revoked` → `401 api_key_revoked`. Permanent, holder-initiated. - unknown / malformed → `401 invalid_api_key`. Model allowlist per key: if `allowedModels` is non-empty and the request references a model outside it → `403 model_restricted`. Setting the list is described under **API keys** above. ### Endpoints | Method | Path | Auth | Description | |---|---|---|---| | `POST` | `/v1/chat/completions` | `Bearer ct_live_*` | OpenAI Chat Completions wire format. Streaming + non-streaming, tools, tool_choice, response_format (`text` \| `json_object` \| `json_schema`). | | `POST` | `/v1/messages` | `Bearer ct_live_*` or `x-api-key` | Anthropic Messages API wire format. Streaming + non-streaming, tools, tool_choice, system prompts, cache_control. | | `POST` | `/v1/responses` | `Bearer ct_live_*` | OpenAI Responses API wire format for coding clients such as Codex, streaming + non-streaming, over a closed grammar: any field, input item, content part or tool type outside it is `422` naming it. `model` must name a model (`auto` is `422`). A supplier's model whose declaration lists the `responses` operation is served natively by its endpoint; every other model is served over chat completions, which carries messages, function calls and their outputs. The exchange keeps no response state — every turn sends the whole conversation in `input`; `previous_response_id` and `store: true` are `422 history_unsupported`. Hosted tools such as `web_search` are `422 operation_unsupported` (in Codex set `web_search = "disabled"`); reasoning another backend produced is `422 history_unavailable`. The WebSocket transport is not offered: a WebSocket handshake on `GET /v1/responses` is `426 operation_unsupported`, on which Codex falls back to HTTP, and any other `GET` there is `422 operation_unsupported`. | | `GET` / `DELETE` | `/v1/responses/{id}` | — | Not offered: the exchange stores no responses, so both answer `422 history_unsupported`. | | `GET` | `/v1/models` | optional `Bearer ct_live_*` or `x-api-key` | OpenAI-format catalog of routable models (`id`, `owned_by`, `displayName`, `maxInputTokens`). Without a key the list is the public catalogue, cached publicly for 60s; with a key it also lists the private models of the key's pool, while the key's account owns or belongs to that pool: each as `handle/alias` with its operations and capabilities, `contextWindow`, `admittedInputTokens` (the largest prompt it admits, counted by the exchange's tokenizer), `maxOutputTokens`, `availability`, `eligibleUpToInputTokens` and `pricing.buyer` (what a request is charged per million tokens in USD, the routing markup included) — narrows both to the key's `allowedModels`, says in `scope` which universe was listed (`pool`; `public` for a key bound to no pool; `detached` when the key's account no longer owns or belongs to its pool, so nothing private is listed) and answers `Cache-Control: private, max-age=10` with `Vary: Authorization, X-Api-Key`. An invalid or revoked key is `401` and a frozen key `403 api_key_frozen` rather than the public list. | | `GET` | `/v1/models/availability` | optional `Bearer ct_live_*` | Which catalogue models can serve a request right now: `{ computedAt, ttlSeconds, models: [{ id, routable }], auto }`. `id` is the canonical `vendor/model` id `/v1/models` publishes; `auto` names the model the `auto` routing directive resolves to from the operator's preference list right now and can be `null`. Scope follows the caller — no `Authorization` header answers for the public supply, a `ct_live_*` key bound to a private pool answers for that pool alone while the key's account owns or belongs to it (`scope: pool`, the models suppliers offer to the pool listed under their `handle/alias` ids with an `availability` each), a key whose account no longer does reads `scope: detached` with nothing routable, and the request carries no pool parameter, so no caller can ask about another pool. An invalid key is `401 invalid_api_key` and a frozen key `403 api_key_frozen` rather than the public answer. Recomputed at most once every 10 seconds, echoed as `ttlSeconds`. The signal is advisory: it is true as of `computedAt`, and a request sent afterwards can still fail with its own error. Ordinary rate limit. | | `GET` | `/v1/usage` | `Bearer ct_live_*` | The account's balance and cumulative spend; the calling key's own `dailyLimit` / `monthlyLimit` and `dailyUsed` / `monthlyUsed`; `dailyRemaining` and `monthlyRemaining` as the tighter of the key's and the account's, with `weeklyRemaining` the account's because a weekly cap exists only there; and the account's cumulative prompt-cache tokens: `cachedInputTokens` (reads), `cacheWrite5mTokens` and `cacheWrite1hTokens` (writes, split by lifetime because the two are priced separately). Each cache counter is `null` until at least one settled request on the account recorded a non-zero count of that kind; the counters are incremented from the same breakdown the receipt stores — the token counts the charges were computed from. | | `GET` | `/v1/inference/estimate?model=&promptTokens=&completionTokens=&reasoningRequested=&toolsPresent=&routing_bias=` | optional `Bearer ct_live_*` or `x-api-key` | Pre-flight cost preview. `model` defaults to `auto` (an empty value reads the same) and is then quoted at the model the exchange chooses for the request you describe — the same per-request choice the send path runs, over the same candidates. Describe it with `promptTokens`, `reasoningRequested` and `toolsPresent` (`true` or `false`, nothing else parses) and lean it with `routing_bias`; a bias beside a named model is `422`, because there is no choice to lean. A named model asked for reasoning or tools it cannot serve is refused with `422`, exactly as the send answers the same request: a catalogue model reasons where its reasoning output is priced and takes tools where its provider does, a supplier's model has exactly the capabilities its declaration of the chat completions operation lists. The response names the priced model as `resolvedModel` alongside `creditsCost`, `creditsWei`, `usdCost`, `reservedWei` — the hold the charge is taken from — and `tierFromInputTokens` — the context tier the quote was priced at, `null` on a flat-priced model; `X-Model-Chooser` names what decided, `engine` for a per-request pick, `list` for the operator's order, `degraded` when the chooser failed and the order served instead. Two things the quote cannot see still move the send: a conversation already pinned to a model is served that model, and a share of `auto` traffic is held on the operator's order as a control arm. The hold covers the costliest candidate and the excess is released at settlement, so a different model answering never costs more than was held. Name a model to quote exactly what will run. The quote is advisory: it prices the token counts you pass, while the bill is always the counts the provider reports. `422 validation_failed` for an unknown model, `503 service_unavailable` when no model has serving capacity or the stored operator route list cannot be read — the second case clears only on operator action, so name a model explicitly instead of retrying. The key is optional; with one the quote answers as that key's send would: a model outside its `allowedModels` is `403 model_restricted` and `auto` walks only the models they grant, a key whose account no longer owns or belongs to its pool is `403 forbidden`, and a `handle/alias` the key's pool is offered is quoted at the supplier's price plus the routing fee, output at most its declared maximum, with the charge, `tierFromInputTokens` and `reservedWei` all priced at `promptTokens` × the model's declared input reserve ratio — or refused with `422 offer_unavailable` where the send would be. The send scales only the prompt's content by that ratio and adds the chat framing unscaled, so such a quote sits slightly above the real hold — by up to (reserve ratio − 1) × the framing tokens — and near the start of a context tier it can price one tier up, or refuse a request the send admits. Without a key such an id is an unknown model; an invalid or revoked key is `401` and a frozen one `403 api_key_frozen`. A keyed answer varies by `Authorization, X-Api-Key`. Rate-limited to 10 req/s. | ### SDKs The same key drives the OpenAI client in TypeScript and the official `anthropic` clients against `POST /v1/messages`. Each heading names the SDK version its snippet is pinned to. **TypeScript (openai SDK, pinned to ^4.76).** ```ts import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.compute.finance/v1", apiKey: process.env.COMPUTE_FINANCE_API_KEY!, // ct_live_... }); const resp = await client.chat.completions.create({ model: "openai/gpt-5.5", messages: [{ role: "user", content: "Hello" }], }); console.log(resp.choices[0].message.content); ``` **Python (anthropic SDK, pinned to 0.116).** ```python from anthropic import Anthropic client = Anthropic( base_url="https://api.compute.finance", api_key="ct_live_...", ) resp = client.messages.create( model="anthropic/claude-opus-4.8", max_tokens=1024, messages=[{"role": "user", "content": "Hello"}], ) print(resp.content[0].text) ``` **TypeScript (@anthropic-ai/sdk, pinned to ^0.120.0).** ```ts import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic({ baseURL: "https://api.compute.finance", apiKey: process.env.COMPUTE_FINANCE_API_KEY!, // ct_live_... }); const resp = await client.messages.create({ model: "anthropic/claude-opus-4.8", max_tokens: 1024, messages: [{ role: "user", content: "Hello" }], }); console.log(resp.content[0].text); ``` ### Wire-format compatibility deltas All three endpoints route through the same provider pool. Requests are validated before dispatch, and a refused request bills no tokens. A malformed or unsupported param returns `422 validation_failed` whose `issues[]` name each offending field where it sits — inside a param that takes several shapes, in the shape the value took. `/v1/responses` answers anything outside its closed grammar with a `422` naming it: `validation_failed`, or, for a reason of the exchange's own, `operation_unsupported`, `history_unsupported` or `history_unavailable`, which name the field in `error.param` and carry no `issues[]`. **Every parameter has one fate.** It takes effect, it is refused with a `422` naming it, or it is ignored under the policy below — never a silent no-op. Anthropic-served models expose no equivalent for `frequency_penalty`, `presence_penalty`, `seed`, `logit_bias`, `logprobs` and `top_logprobs`, so those are dropped and the request is served; on every other provider they are forwarded and the vendor decides what to do with them. `tool_choice` and `parallel_tool_calls` sent without a non-empty `tools` list govern nothing and are dropped along with it. Current Claude models accept `temperature` only at `1.0` and `top_p` only at `0.99` or above, so any other value is refused naming the accepted one rather than passed on to fail at the vendor. **End-user identifiers.** `user` — and `metadata.user_id` on `/v1/messages` — reaches every provider as a stable, irreversible fingerprint of the identifier and your account, computed before the request leaves the exchange, or is dropped entirely where the operator has configured no fingerprint key. The same end user carries the same marker on every request, every provider and every key of your account, so a vendor can attribute repeat abuse to that one end user instead of banning the whole contributor key. Another account sending the same identifier gets an unrelated marker, so no vendor can link your end users to it or carry a ban from one to the other, and the identifier you send reaches no third party. **OpenAI Chat Completions.** Supported: `model`, `messages`, `stream`, `temperature`, `max_tokens`, `max_completion_tokens`, `top_p`, `stop`, `frequency_penalty`, `presence_penalty`, `seed`, `logit_bias`, `user`, `logprobs`, `top_logprobs`, `reasoning_effort`, `reasoning`, `response_format` (`text` / `json_object` / `json_schema`), `tools`, `tool_choice`, `parallel_tool_calls`. Compute Finance additions: `models` (ordered fallback list, 1–8 entries), `conversation_id`, `routing_bias` (`cheaper` / `balanced` / `better`, which leans an `auto` choice and is refused anywhere else). `messages[].content` takes a string or an array of up to 50 text parts (`{"type":"text","text":"…"}`). **Not supported (422):** `functions` / `function_call` (legacy — use `tools` / `tool_choice`), `n > 1` (single completion only), non-text `content` parts (`image_url` and the rest — the error names the offending part type). **Anthropic Messages.** Supported: `model`, `messages`, `max_tokens`, `system`, `metadata.user_id`, `stop_sequences`, `stream`, `temperature`, `top_p`, `thinking` (`{"type":"enabled","budget_tokens":N}` / `{"type":"disabled"}`), `tools`, `tool_choice`, content blocks (`text`, `tool_use`, `tool_result`), `cache_control` on a `text` block, on a `system` block, on a text block inside a `tool_result`, and on a `tools[]` entry. Compute Finance additions: `models` (ordered fallback list), `routing_bias`. Extra fields on message objects are rejected (`.strict()` mode). **Client fallback list (`models[]`).** Send `models` — an ordered list of catalogue ids (1–8). `model`, when present, is tried first, then each entry in turn; an entry lacking capacity or a requested capability is skipped. The request is billed at the model that answered (the pre-authorization covers the costliest listed entry; the excess is released at settlement), and the served model is reported in `vendor/model` form in the response body and the `X-Model-Used` header. Combining `models` with `model: "auto"` is rejected. Limitations: a prompt exceeding an entry's context window, or a parameter an entry rejects as invalid, aborts the request rather than falling through — fall-through covers capacity and capability, not `422`-class input errors. **Provider capability gating.** Advanced features (tools, structured outputs) only work on providers that support them natively — currently `openai` and `anthropic`. A single named model on another provider returns `422 validation_failed`; inside a `models[]` list, such an entry is skipped and the request fails only if no listed entry supports the feature. ### Responses API **Two ways to serve.** `POST /v1/responses` serves a named model — `auto` is refused — in one of two modes its declaration decides and the request never does. **Native**: a supplier's model whose declaration lists the Responses operation; the request goes to the endpoint's own `/responses` with `store: false`, and its events come back with `id`, `model` and `usage` set by the exchange. **Mapped**: every other model, catalogue models included; the request is translated into a chat completion and the answer back into Responses events. What each mode accepts: | Part of the request | Native | Mapped | | --- | --- | --- | | Fields | `model`, `input`, `instructions`, `tools`, `tool_choice`, `parallel_tool_calls`, `reasoning`, `text`, `max_output_tokens`, `store`, `include`, `stream`, `stream_options`, `prompt_cache_key`, `metadata`, `client_metadata`, `user`, `truncation`, `service_tier` | `model`, `input`, `instructions`, `tools`, `tool_choice`, `parallel_tool_calls`, `reasoning`, `text`, `max_output_tokens`, `store`, `include`, `stream`, `stream_options`, `prompt_cache_key`, `metadata`, `client_metadata`, `user`, `truncation`, `service_tier` | | Input items (input[].type) | `message`, `function_call`, `function_call_output`, `custom_tool_call`, `custom_tool_call_output`, `reasoning`, `tool_search_call`, `tool_search_output`, `additional_tools` | `message`, `function_call`, `function_call_output`, `custom_tool_call`, `custom_tool_call_output`, `tool_search_call`, `tool_search_output`, `additional_tools` | | Content parts | `input_text`, `output_text` | `input_text`, `output_text` | | Tools (tools[].type) | `function`, `custom`, `namespace`, `tool_search` | `function`, `custom`, `namespace`, `tool_search` | **Everything else is refused, never stripped** — a `422` naming what was sent. A field outside the table — `models` included, since `/v1/responses` takes no fallback chain — and an item, content part or tool type the exchange does not know answer `validation_failed`, the latter listing the accepted ones. One it knows and does not serve for the model's mode answers `operation_unsupported`: a hosted tool such as `web_search`, an item or part the table does not list — images, files and audio included — or a tool type the table does not list for that mode. `history_unsupported`: `previous_response_id`, `store: true`, an `item_reference`, and reading or deleting a stored response through `GET` or `DELETE /v1/responses/{id}` — the exchange keeps none. `history_unavailable`: a reasoning item on a mapped model, or one another backend produced. The WebSocket transport is not offered: its handshake on `GET /v1/responses` answers `426`. **Namespaces on a mapped model.** Function and custom tools inside a `namespace` reach Chat Completions with the namespace and tool name joined by `__`. Responses restores each call's own `name`, `namespace` and function/custom type; replay uses the same chat name. Names must match `^[a-zA-Z0-9_-]{1,64}$` and remain unique. Invalid or colliding names, and a `tool_choice` forcing a tool inside a namespace, return `operation_unsupported`. A forced plain tool must be active and match its declared type. **Custom tools and grammar.** Chat Completions and Responses preserve raw custom-tool input and its text, Lark or regex format. Read `customToolFormats` from `GET /v1/models`: on a private model, check the operation that will serve the request. Use only advertised formats; an empty list does not advertise custom-tool support. A request requiring an unadvertised format returns `validation_failed` before inference. In Responses, return `custom_tool_call_output` with the original `call_id`, and replay the call and output in subsequent requests. Custom input streams through `response.custom_tool_call_input.delta` and `response.custom_tool_call_input.done`. This applies to eager tools and tools loaded through search. **Discover tools on demand.** Choose a model that supports tools. Client-executed search works through mapped Chat Completions or a compatible native Responses backend. Add `tool_search` to `tools`. Keep the full tool registry in your client. When the model returns `tool_search_call`, search that registry using its `arguments`, then append the call and a `tool_search_output` to `input`. Set the output's `execution` to `client`, copy the call's `call_id`, and put only the discovered definitions in `tools`. Execute the resulting `function_call` and return its `function_call_output` as usual. **Client-executed search: tools entry** ```json { "type": "tool_search", "execution": "client", "parameters": { "type": "object", "properties": { "query": { "type": "string" } }, "required": [ "query" ], "additionalProperties": false } } ``` **Keep discovered tools available.** Send the full conversation history on each turn, including the search calls, their outputs with the discovered definitions, and subsequent tool calls and results. The history makes those tools available again; the unselected registry stays in your client. The exchange does not store this state, and `previous_response_id` is unsupported. A request may also add definitions at a chosen point in history with `{"type":"additional_tools","role":"developer","tools":[...]}`. Loaded definitions obey the same tool restrictions as top-level `tools`. **Support and alternatives.** On mapped models, client search uses ordinary function calls; the exchange returns them as `tool_search_call` items. Only eager tools and tools activated by search outputs or `additional_tools` reach the chat model. Candidate tools with `defer_loading: true` stay unloaded until discovered. Loaded custom tools require the format advertised for the serving operation. For backend-executed search, use a compatible native Responses model, send `{"type":"tool_search"}` and mark candidate functions or custom tools with `defer_loading: true`; this sends candidate definitions to the backend. Mapped models reject backend-executed search with `operation_unsupported`. Native support depends on the endpoint's model and connection; a backend rejection returns `upstream_rejected`. OpenAI's ChatGPT token-sharing connection does not accept native `tool_search`. See the [OpenAI tool-search guide](https://developers.openai.com/api/docs/guides/tools-tool-search) and [ChatGPT connection limitations](https://developers.openai.com/siwc/token-sharing-open-source/preview-limitations). **Field notes.** `max_output_tokens` bounds the hold, and natively is capped at the model's declared maximum. A `reasoning.effort` other than `none` needs a model with the reasoning capability, and on a mapped model is one of none, low, medium, high. A `json_schema` or `json_object` `text.format` needs structured outputs. `metadata`, `client_metadata` and `service_tier` are accepted and dropped, and so, on a mapped model, are `include`, `stream_options` and `truncation`. **Events.** A mapped model streams `response.created` and `response.in_progress`, then its text as a message — `response.output_item.added`, `response.content_part.added`, `response.output_text.delta`, `response.output_text.done`, `response.content_part.done`, `response.output_item.done` — until its first function call starts. That call streams live: `response.output_item.added`, its arguments in `response.function_call_arguments.delta`, `response.function_call_arguments.done`, `response.output_item.done`. A call that starts while another streams is held until the answer finishes and then sent whole, in index order, followed by any text that came after the first call as a message of its own. It ends with `response.completed`, or `response.incomplete` when the answer stopped at its length or a filter, and emits no reasoning. A native model's events are relayed in order, renumbered. Nothing is sent before a stream's first output, the response headers included, so until then a client waits on the HTTP response. From its first event on, a stream that has written nothing for 15 seconds writes `response.in_progress` with the response so far, until its terminal event, so a client's idle timeout does not fire while a model works silently. The terminal event carries `usage`, the counts billed, or `null` when nothing was billed; there is no `x_credits_used`. **Failures inside a stream.** A stream that breaks after its first output and before its end — a native endpoint's terminal event, or the finish reason of a mapped model's chat answer — ends with `response.failed` carrying `stream_interrupted` and no `response.completed`; one that breaks after its end is a completed answer, a native one billed by the usage its terminal event carried. An input longer than the model's context answers a streamed request `200` with `response.failed` carrying `context_length_exceeded` — the code that tells a Responses client its context is full, so it can trim or compact its history — and an unstreamed one `422`. Compaction is no server operation: a client compacts with an ordinary request, reserved and billed like any other. Codex settings are under [Private endpoints → Codex](https://docs.compute.finance/#private-codex). ### Prompt caching **What you may send.** On `/v1/chat/completions` a message's `content` is either a string or an array of up to 50 text parts (`{"type":"text","text":"…"}`); a part of any other type — `image_url` and the rest — is refused with `422 validation_failed` naming the offending part type. On `/v1/messages` a message's `content` is either a string or up to 200 blocks of type `text`, `tool_use` or `tool_result`, `system` is either a string or up to 20 `text` blocks, and a `tool_result` holds up to 50 `text` blocks; any other block type is refused the same way, naming it. Every text part counts toward the input estimate that sizes the reservation and toward the bill. **Where the breakpoint goes.** A text part may carry `cache_control: {"type":"ephemeral"}`, optionally with a `ttl` of `"5m"` (the default) or `"1h"`; any other value is refused before the request is priced. The marker is accepted on a message text part, on a `system` text block, on a text block inside a `tool_result`, and on a `tools[]` entry — in the OpenAI wire format (`{"type":"text","text":"…","cache_control":{"type":"ephemeral"}}`) and in Anthropic's native block form alike: ```json { "model": "anthropic/claude-opus-4.8", "messages": [ { "role": "system", "content": [ { "type": "text", "text": "You are a contract analyst. Answer only from the contract below.", "cache_control": { "type": "ephemeral", "ttl": "1h" } } ] }, { "role": "user", "content": [ { "type": "text", "text": "", "cache_control": { "type": "ephemeral" } }, { "type": "text", "text": "Which termination clauses changed?" } ] } ] } ``` The marker is refused on a part with no text — a breakpoint must ride text — and on the `tool_result` block itself rather than on a text block inside it. How many breakpoints one request may carry is capped by the provider; above that cap the provider refuses the request, and its own explanation comes back in the error message. **A provider that cannot express one.** The marker reaches Anthropic-served models in Anthropic's own block form. On every other provider the text parts are joined into one string and the marker is removed before the call — the request is served normally, with no error and no warning. Those vendors may still cache implicitly: where a vendor reports the hit in the usage shape the exchange reads for that vendor it is billed at the model's cache-read price, and where a vendor reports a hit in any other shape, those tokens are billed as fresh input. **What it costs.** A cache write is billed at the model's cache-write price for the `ttl` requested — `5m` and `1h` are priced separately — and a later hit at its cache-read price. Both are components of the same published price list as input and output, under the same routing markup. Cache usage comes back in the wire format you called: `usage.prompt_tokens_details.cached_tokens` on `/v1/chat/completions`, `usage.cache_read_input_tokens` (with writes under `usage.cache_creation.ephemeral_5m_input_tokens` / `ephemeral_1h_input_tokens`) on `/v1/messages`. `GET /v1/inference/estimate` is not cache-aware: a hit is not knowable before the request runs, so the quote prices the whole input as fresh. `GET /v1/usage` reports the same tokens cumulatively for the account behind the key — `cachedInputTokens` for reads, `cacheWrite5mTokens` and `cacheWrite1hTokens` for writes at each lifetime. Each is `null` until at least one settled request on the account recorded a non-zero count of that kind, so an account that has never used caching carries `null` for all three, and the counters are incremented from the same breakdown the receipt stores: exactly the token counts the charges were computed from. Both write lifetimes collapse into `usage.prompt_tokens_details.cache_creation_tokens` on `/v1/chat/completions`, so the two cumulative write counters reconcile per request only on `/v1/messages`, which splits them. ### Reasoning **Two controls, one behaviour.** `reasoning_effort: "low" | "medium" | "high"` (OpenAI wire format) and the structured `reasoning` object (OpenRouter convention) both switch reasoning on and map onto the same provider wiring, so an OpenRouter-native client works unchanged: | Field | Type | Meaning | |---|---|---| | `reasoning.effort` | `"low" \| "medium" \| "high"` | Reasoning depth. Equivalent to `reasoning_effort`. | | `reasoning.max_tokens` | integer, 1024–200000 | Explicit thinking budget in tokens. Mutually exclusive with `effort` and with `reasoning_effort`. | | `reasoning.enabled` | boolean | `true` without a budget uses effort `medium`; `false` switches reasoning off. | | `reasoning.exclude` | boolean | Think, but keep the reasoning out of the response. | Any `reasoning` object without `enabled: false` switches reasoning on. A bare `reasoning: {}` and `reasoning: {"exclude": true}` both run at effort `medium` and are billed for the thinking tokens they generate — `exclude` hides the reasoning, it does not opt out of it. Contradictory values across the two controls are `422 validation_failed` naming both fields — never a silent priority. Contradictions: two different effort levels, an effort together with `reasoning.max_tokens`, or `enabled: false` alongside any requested budget. **Effort → thinking budget.** The effort level becomes a thinking budget as a share of `max_tokens` (`max_completion_tokens` wins when both are sent; the default is 4096), floored at 1024 tokens — Anthropic's minimum, applied on every provider. The budget must stay below `max_tokens`; a request that leaves no room for an answer returns `422 validation_failed` naming both numbers, before it reaches a provider and before any credits move. | `reasoning_effort` | Thinking budget | |---|---| | `low` | 20% of `max_tokens` | | `medium` | 50% of `max_tokens` | | `high` | 80% of `max_tokens` | On OpenAI-shaped providers the effort level is forwarded as `reasoning_effort`; an explicit `reasoning.max_tokens` maps onto the closest effort bucket in the same table. **Where reasoning is available.** Reasoning is enabled on a catalogue model exactly where its reasoning output is priced in the catalogue, and on a supplier's model where its declaration lists reasoning for the operation called. A single named model without it returns `422 validation_failed`; inside a `models[]` list, such an entry is skipped and the request fails only if no listed entry can reason. To check a catalogue model before you send it, read `GET /v1/oracle/models` — or `GET /v1/oracle/catalog` for models outside the basket: both return a `reasoning.reasoningOutput` price block for exactly the models that can reason, and `reasoning: null` for the rest. A supplier's model lists its capabilities per operation in `GET /v1/models` sent with the key. **Reasoning output.** The assistant message carries a `reasoning` field alongside `content`; streaming chunks carry `delta.reasoning` before the content deltas. The name is the same on every provider — a model whose own API returns its thinking under `reasoning_content` is renamed before the response leaves the exchange, streaming and non-streaming alike, and `exclude` withholds it just the same: ```json {"choices":[{"index":0,"message":{"role":"assistant","content":"42","reasoning":"The question asks for..."},"finish_reason":"stop"}]} ``` ``` data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":...,"model":"anthropic/claude-opus-4.8","choices":[{"index":0,"delta":{"reasoning":"The question asks"},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":...,"model":"anthropic/claude-opus-4.8","choices":[{"index":0,"delta":{"content":"42"},"finish_reason":null}]} ``` With `reasoning.exclude: true` the model still reasons and the reasoning tokens are still generated and billed — only the output is withheld. Hiding the reasoning does not make it free. **Anthropic Messages (`/v1/messages`).** The native `thinking` parameter sets the same budget as `reasoning.max_tokens`: `{"type":"enabled","budget_tokens":N}` obeys the same 1024 floor and the same below-`max_tokens` rule, while `{"type":"disabled"}` switches reasoning off and no thinking parameter is forwarded at all. If the request falls through to an OpenAI-shaped entry, the budget maps onto the closest effort bucket. Reasoning comes back as `thinking` content blocks ahead of the text block, carrying the `signature` Anthropic issued when an Anthropic model served the request and an empty `signature` when another provider did; streaming emits `thinking_delta` events on that block, plus `signature_delta` when a signature was issued. Message content blocks accept `text`, `tool_use` and `tool_result`; a `thinking` block in an assistant turn is rejected with `422 validation_failed`. Strip thinking blocks from an assistant turn before you replay it. **Billing.** Reasoning tokens are output tokens: they are counted in `completion_tokens` and billed at the model's output rate. There is no separate reasoning charge. ### Streaming All three endpoints support Server-Sent Events (`Accept: text/event-stream`) when `stream: true`. Wire formats differ per SDK contract. **OpenAI (`/v1/chat/completions`).** ``` data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":...,"model":"...","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":...,"model":"...","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]} ... data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":...,"model":"...","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":10,"completion_tokens":5,"total_tokens":15},"x_credits_used":"...","x_credits_remaining":"...","x_ratelimit_requests_remaining":123} data: [DONE] ``` **Anthropic (`/v1/messages`).** Named events per the Anthropic Messages streaming protocol: ``` event: message_start data: {"type":"message_start","message":{"id":"msg_...","type":"message","role":"assistant","content":[],"model":"...","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":10,"output_tokens":0}}} event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}} event: content_block_stop data: {"type":"content_block_stop","index":0} event: message_delta data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":5}} event: message_stop data: {"type":"message_stop"} ``` **OpenAI Responses (`/v1/responses`).** `event:`-named Responses events: `response.created`, then per output item `response.output_item.added`, its deltas and `response.output_item.done`, ending with `response.completed` or `response.incomplete` whose `usage` is what was billed — the counts the upstream reported, with a side a catalogue model's vendor left out measured — and `null` only when nothing was billed. A stream that breaks after its first output ends with `response.failed` (`error.code` `stream_interrupted`) and no `response.completed`; an input longer than the model's context answers `200` with `response.failed` (`context_length_exceeded`). A model served natively relays every event its endpoint emits. A stream that has written nothing for 15 seconds writes `response.in_progress` with the response so far, until its terminal event, so a client's idle timeout never fires while a model works silently. Stop reasons are translated between wire formats: OpenAI's `stop` ↔ Anthropic's `end_turn`, `length` ↔ `max_tokens`, `tool_calls` ↔ `tool_use`. ### Response headers Every inference response (streaming and non-streaming) includes: - `X-Model-Used` — the model that actually answered this request, in `vendor/model` form, or `handle/alias` for a supplier's model. - `X-Model-Requested` — the model the exchange set out to serve: the one the request named, or the head of the chain `auto` resolved to. - `X-Fallback-Used` — `true` exactly when the two above differ, `false` otherwise. - `X-Model-Chooser` — on every `auto` answer, what picked the model: `engine` (a choice made for this request), `pin` (the model this conversation is already on), `list` (the operator's preference order), or `degraded` (the per-request choice could not be made, so the preference order served). Absent when the request named a model. - `X-Provider` — vendor slug of the provider that served the request, or the supplier's handle when a supplier's endpoint served it. - `X-Routing-Strategy` — how the capacity was chosen: `sticky` or `weighted-random` for a provider key, `endpoint` when a supplier's model was served by its own endpoint, or `failover` after a retry or a fallback entry took over. - `X-Request-Id` — identifier of this request; every response the API sends carries it, a refusal or an error included. Quote it in a support request: for a request that reserved a charge it finds the full record, for any other its log lines. - `X-Compute-Used` — actual credits debited for this request, in wei. - `X-Compute-Remaining` — buyer's remaining `$COMPUTE` balance after settlement, in wei. - `X-Key-Daily-Remaining` / `X-Key-Monthly-Remaining` — per-key spending cap remainder in wei, or `unlimited` if the corresponding cap is not set. The account's weekly cap has no header; read it from `GET /v1/usage`. - `X-RateLimit-Limit` / `X-RateLimit-Remaining` / `X-RateLimit-Reset` — canonical rate-limit trio for the tightest active bucket. Streaming final chunk mirrors the compute values into the body as `x_credits_used`, `x_credits_remaining`, `x_ratelimit_requests_remaining` for clients that consume streams without inspecting headers. ### Errors Shared envelope: ```json { "error": { "message": "human-readable summary", "type": "invalid_request_error | validation_error | rate_limit_error | insufficient_quota | forbidden | server_error", "code": "invalid_api_key | validation_failed | upstream_rejected | insufficient_balance | ...", "param": "field name — optional, present when the error is bound to input", "details": { "...": "code-specific structured payload" }, "issues": [ "per-field validation errors, present on a validation_error" ] } } ``` `type` is a coarse category derived from `code`: `invalid_request_error` for a malformed or unauthenticated request, `forbidden` for a key or a model the caller may not use, `insufficient_quota` for an exhausted balance, `rate_limit_error` for a spending cap, a pool ceiling or a supplier endpoint's limit, and `server_error` for a failure here or upstream. `validation_error` is the one value not derived that way, and it splits `code: validation_failed` — the `422` for a request the exchange refuses itself: a body that fails schema validation answers `validation_error` and lists every offending field in `issues[]`, while a body that parsed and was then refused further in — a parameter the exchange knows the target upstream refuses, a capability the requested model does not offer, an input above the model's window — answers `invalid_request_error`, carries no `issues[]`, and names the field in `param` when the refusal is bound to one. Both carry `code: validation_failed`, so `type` is what tells them apart. A refusal the upstream itself returned — a vendor or a supplier's endpoint — is the other `422`, `code: upstream_rejected`, and always answers `invalid_request_error`. Inference-relevant codes: | Code | Status | When | |---|---|---| | `unauthorized` | 401 | `GET /v1/usage` was sent without an `Authorization: Bearer` header. | | `invalid_api_key` | 401 | Missing / malformed / unknown key. | | `api_key_revoked` | 401 | Key was revoked by the owner. | | `api_key_frozen` | 403 | Key is administratively frozen. | | `forbidden` | 403 | The key stopped reaching supply while its request was in flight: its account left the key's pool between authentication and routing, or the admission a supplier's model runs before each attempt found the key revoked or frozen or its account outside the pool. A key revoked or frozen before the request answers `api_key_revoked` or `api_key_frozen` instead. | | `model_restricted` | 403 | Requested model is not in the key's `allowedModels`. | | `validation_failed` | 422 | The exchange refused the request before dispatch. A schema failure answers `type: validation_error` and lists every offending field in `error.issues[]` — `functions` / `function_call`, `n > 1` and a non-text content part are refused here. A body that parsed and was then refused further in — a parameter the exchange knows the target upstream refuses, a capability the requested model does not offer, an input above the model's window — answers `type: invalid_request_error` and carries no `issues[]`. | | `offer_unavailable` | 422 | The request named a supplier's `handle/alias` model that cannot serve it, and no entry of the chain was sent upstream. `details.model` names it; `details.reason` says why — `awaiting_acceptance` (the pool owner has not accepted its current declaration), `price_above_ceiling` (the supplier's price at this request's input size is above the ceilings the pool owner accepted), `endpoint_disabled`, `endpoint_removed`, `model_retired`, `offer_closed` (the offer of its endpoint to the pool was revoked or rejected by the pool owner or withdrawn by the supplier), `validation_failed` (its endpoint has not passed validation for the requested operation) or `cooldown` (its endpoint failed the requested operation repeatedly and becomes available again on its own shortly); `details.actor` names who has to act first for it to serve again, `pool_owner` or `supplier` — a closed offer also needs the pool owner to accept the supplier's new share, a retired model the owner to accept its new declaration, and a cooling-down endpoint is the supplier's to fix — and is `null` for a removed endpoint, which never serves again. Inside `models[]` such an entry is skipped, also when it becomes unavailable while the request is being routed, and a request whose other entries were sent upstream and failed answers `all_routes_exhausted` instead. Nothing was charged. | | `operation_unsupported` | 422 | `POST /v1/responses` named a hosted tool — `web_search` (in Codex, set `web_search = "disabled"`), `file_search`, `code_interpreter`, `mcp` and the rest — or an input item or content part the exchange does not carry, such as `input_image`, `input_file` or a compaction item; or a model served over chat completions was sent server-executed `tool_search` or its history (use `execution: "client"` with a `parameters` schema and perform discovery in the client), a `tool_choice` naming a tool inside a `namespace`, or a tool whose chat name — `__` inside a namespace — does not match `^[a-zA-Z0-9_-]{1,64}$` or names another tool. `GET /v1/responses` answers it too, because the WebSocket transport is not offered: `426` on a WebSocket handshake, on which Codex falls back to HTTP, and `422` otherwise. `error.param` names what was refused — the field, with the item's index, or `transport`. Nothing was charged. | | `history_unsupported` | 422 | The request relied on response state the exchange does not keep: `previous_response_id`, `store: true`, an `item_reference`, or reading or deleting a stored response. Send the whole conversation in `input` on every turn. Nothing was charged. | | `history_unavailable` | 422 | `input` replayed a `reasoning` item the requested model cannot continue — the model is served over chat completions, or another model's backend produced it. Continue on the model that produced it, or start anew; the exchange never drops history to make a request fit. Nothing was charged. | | `upstream_rejected` | 422 | The upstream the request was routed to — a vendor or a supplier's endpoint — refused it as invalid: a limit or parameter only that upstream enforces. `error.message` carries the upstream's reason after the vendor slug or supplier handle that names it, cut to 200 characters; `details.upstreamStatus` is the status it answered with, or `null` when it gave none — a refusal inside an answer it began with `200`, such as a Responses `response.failed`. The same request fails again the same way. | | `payload_too_large` | 413 | The body is larger than the request-body ceiling under Request size; it is refused before it is parsed. | | `method_not_allowed` | 405 | Endpoint exists but this HTTP method is not accepted (e.g. `GET` on `POST /v1/chat/completions`). The `Allow` response header lists the accepted methods. | | `insufficient_balance` | 402 | Buyer's `$COMPUTE` balance cannot cover the reserve estimate. | | `spending_limit_reached` | 429 | A spending cap hit — daily or monthly on the key, daily / weekly / monthly on the account — counting requests in flight at their reserved amount. `details: { scope, cap }`. | | `rate_limited` | 429 | A route's request-rate cap was hit (such as `GET /v1/inference/estimate` or `GET /v1/models/availability`) — then `details: { scope, retryAfterSeconds }`, `scope` being `caller` when the signed-in wallet or app grant spent its own allowance and `address` when the network address spent the one its callers share, and `Retry-After` carries the same wait, the longest among the windows that refused — or the pool's RPM/TPM cap — then `details: { scope: "pool" }` — or the supplier endpoint serving a pool's model is at its own concurrency, request-rate or token-rate limit — then `details: { scope: "endpoint", model }`, and inside `models[]` the next entry is tried instead. | | `all_routes_exhausted` | 502 | Every route tried for the requested models failed before any output — the capacity serving them was unavailable, rate-limited, cooling down or answered with an error. Nothing was charged; retry shortly. | | `deadline_exceeded` | 504 | The request ran out of its time budget while it was still being routed, before any upstream produced output. Nothing was charged; retrying may succeed. | | `stream_interrupted` | 500 | Delivered inside the SSE body: the upstream's stream dropped or ended without finishing after output had started, or the request ran out of its time budget while the answer was streaming. The exchange fails over to other capacity only before the first output, so a stream that already delivered output is never retried for you. On a catalogue model an answer its vendor broke is not charged, and one the time budget cut is charged for the prompt and the output streamed before the cut; a supplier's model is charged by the usage its endpoint reported before the stream ended when that usage is valid, and not at all otherwise. A request that fails after its answer was delivered in full ends with an `internal_error` instead. | | `internal_error` | 500 | An unexpected failure; on a stream whose answer was already delivered in full it arrives inside the SSE body. | | `service_unavailable` | 503 | No capacity serving the requested models was available to try — nothing was sent upstream and nothing was charged; retry shortly, or name another model — or a dependency the request needs (the price snapshot, the `$COMPUTE` peg, Redis) is unavailable. An operator setting that cannot be read, such as the route list `auto` walks, answers it until an operator fixes it, so name a model rather than retry. | ### Rate limits Three independent limiter tiers apply to `/v1/chat/completions`, `/v1/messages` and `/v1/responses`: - **Spending caps.** Daily and monthly caps on `$COMPUTE` spend, configured per API key, plus daily, weekly and monthly caps on the account. Exceeding a cap returns `429 spending_limit_reached` with `details: { scope: "key" | "account", cap: "daily" | "weekly" | "monthly" }`; a request in flight counts against the caps at its reserved amount until it settles, and the weekly cap is account-only. What is left of the key's caps is surfaced in `X-Key-*-Remaining` headers, and `GET /v1/usage` reports the remainder under both scopes. - **Per-pool RPM/TPM.** Pool-level ceilings enforced atomically on 1-minute buckets. Exceeding returns `429 rate_limited` with `details: { scope: "pool" }`. - **Supplier endpoint limits.** A pool's model served by a supplier's own endpoint is also bounded by the concurrency, RPM and TPM limits the supplier set on that endpoint, checked before every attempt. At a limit a request for that model alone returns `429 rate_limited` with `details: { scope: "endpoint", model }`; inside `models[]` the next entry is tried instead. `GET /v1/inference/estimate` is throttled to **10 requests per second per source IP**; a key is optional and it does not consume `$COMPUTE`. ### Request size **Body ceiling.** A request body may be up to **4194304 bytes (4 MiB)** — the room the largest context the exchange serves, **1048576 input tokens**, needs on the wire. A larger body is refused with `413` before it is parsed. The ceiling is fixed for the whole exchange and applies to `/v1/chat/completions`, `/v1/messages` and `/v1/responses` alike. **Per-model maximum.** A model may declare the context window its vendor actually serves. A request whose estimated input exceeds it fails with `422 validation_failed` naming the model and its limit — before the request reaches a provider and before any `$COMPUTE` is reserved, so an oversized attempt costs nothing. A model that declares no maximum is bounded only by the body ceiling. `GET /v1/inference/estimate` runs the same check, so a request can be sized before it is sent. Every declared window is published as `maxInputTokens` on `GET /v1/models` and in the full catalog at `GET /v1/oracle/catalog`, absent on a model that declares none. On `/v1/responses` a streamed request gets that answer in-band instead — `200` with `response.failed` carrying `context_length_exceeded`, the code that tells a Responses client its context is full, so it can trim or compact its history, and the one it also receives when the upstream itself refuses the input as too long; an unstreamed request keeps the `422`. **Inside a fallback chain.** An entry of `models[]` that the exchange cannot serve right now is skipped and the next candidate takes over. An input too long for an entry is not skipped: the length is a property of the request, so the request fails naming that entry rather than quietly falling through to a model the caller did not ask for. Only `model: "auto"` narrows on length — there the exchange picked the candidates, so it routes to one whose window holds the request and returns `422` only when none does. ### Billing Every inference request follows a **reserve-then-settle** flow: 1. Estimate the input token count from `messages`, the tool schema and the response format. Estimated output = `max_completion_tokens ?? max_tokens ?? 4096` on a catalogue model; on a supplier's model, that request value when it is within the model's declared `maxOutputTokens`, and `maxOutputTokens` otherwise. 2. Convert `(input, output, model)` to credits — at the Oracle's metered rate for a catalogue model, at the supplier's rates, within the pool owner's ceilings, for a supplier's model — plus a 5% routing markup, expressed in wei. 3. Reserve the estimated wei against the account balance. An insufficient balance returns `402 insufficient_balance`; hitting a per-key or per-account spending cap returns `429 spending_limit_reached`. An account with nothing left to spend is refused with the same `402` before step 1, so a request it could never pay for is never estimated. 4. Route to the provider, stream or receive the response, capture actual usage. 5. Settle the reservation: release the estimate, charge the actual metered cost, and update the per-key and per-account usage counters. Settlement always charges what the request actually used, so a request whose real cost outruns its estimate can leave the balance negative; the next request is refused with `402 insufficient_balance` until the account is topped up. Response headers `X-Compute-Used` and `X-Compute-Remaining` report the final debit and remaining balance. **The estimate is advisory; the bill is not.** The input estimate — the one that sizes the reservation and picks the context tier it is held at — counts the message text, the tool schema and response format, and the per-message chat framing the provider wraps every turn in. Name a model whose provider publishes its own token counter and the estimate is that vendor's count of that request: an Anthropic model is counted by Anthropic, and no chat framing is added on top, because the vendor's own count already carries it. Everything else is counted locally through the `o200k_base` BPE vocabulary at a pinned tokenizer version and scaled into the target model's vocabulary by that vendor's fixed ratio, so the same request reserves the same amount — above a small minimum floor, and outside the rare fallback where the vocabulary cannot be loaded. `auto` is always counted that way: the serving model is chosen after the hold is taken, so no single vendor can be asked; so is a vendor counter that declines or times out. Each candidate model is counted in its own vocabulary and the reservation is held at the costliest of them. None of it decides what you pay: settlement charges the token counts the provider reported, at the tier those counts select. `GET /v1/inference/estimate` tokenizes nothing — it prices the `promptTokens` and `completionTokens` it is handed. Counting the prompt with the same `o200k_base` vocabulary and adding 4 tokens per message plus 3 for the reply reproduces a locally counted reservation; a named model its vendor counts will hold a different amount, and only that vendor's own count reproduces it. A supplier's model quotes slightly above its hold, because the quote scales the framing by the model's input reserve ratio along with the content. **A supplier's model in a private pool** is billed only by the usage its endpoint reports with the answer, never above the cap held for it before dispatch — see [Private endpoints → Money](https://docs.compute.finance/#private-money). **Long context.** A model may carry a ladder of context tiers: ordered input-token thresholds, each with its own input and output price. The tier is chosen by the whole input side of the request — prompt tokens plus cache reads plus cache writes — and a request landing exactly on a threshold is priced at the higher tier. Both the reservation and the settlement select a tier, but only the settlement decides the bill: it re-selects from the token counts the provider actually reported, so an estimate that lands in the wrong tier changes how much was held, never how much was charged. A cache or reasoning price the catalogue attests is single-level, but a kind the catalogue does not price separately is billed at its side's rate, that side's context tier included. A flat-priced model — one with no ladder — costs the same at every length. Quote a specific size with `GET /v1/inference/estimate` — its `tierFromInputTokens` names the tier the bill will use for that input. --- ## Private endpoints Use models from a supplier you trust through your private pool. The supplier connects an endpoint and sets prices; the pool owner approves the offer; members use it with a Compute Finance API key. Choose the setup for your role below. You can provide models, manage a pool and use its models with the same account. Connect your endpoint in [Earn & Credits](https://compute.finance/dashboard/deposit), manage access in [Pools](https://compute.finance/dashboard/pools) and create a pool key in [API Keys](https://compute.finance/dashboard/api-keys). Every step can be done in the app. #### Before using the API examples **Your session token.** `GET /v1/auth/payload?address=…` answers the fields of a sign-in message (SIWE, EIP-4361) for your wallet address. Build the message text from them as EIP-4361 lays it out — `invalid_before` is its `Not Before` line — sign that text with the wallet (`personal_sign`, EIP-191) and send the payload unchanged, with the signature, to `POST /v1/auth/login` as `{ payload, signature }`. The answer's `token` is `$CF_SESSION`, valid for 30 days, and `POST /v1/auth/logout` revokes it. An account that signs in by email keeps its wallet inside the app, so it does every supplier and pool-owner step there, on the pages above. The examples need `curl` and `jq`. Set `export CF_API=https://api.compute.finance`, then supply the variables shown above each example. Run: create a pool → connect and share the endpoint → accept the offer → create a buyer key → call a model. Run the supplier's price-change and withdrawal example only after testing: it changes the price and removes access. Choose your own `$HANDLE` and `$ALIAS`; the model id is `$HANDLE/$ALIAS`. ### Suppliers: connect an endpoint 1. **Connect your endpoint.** Choose a permanent supplier handle, review the terms, then add your HTTPS base URL and endpoint credential. 2. **Add and check your models.** Set each model's name, supported APIs, limits and prices. Test the connection and resolve any failed checks before sharing. 3. **Share with a pool.** Ask its owner for the Pool ID. The owner reviews your offer before members can use it. If you manage that pool, you can accept it while sharing. Track usage and payments in the endpoint's earnings. #### Endpoint requirements and supplier API examples **Handle.** Register a handle once: 3 to 32 lowercase letters, digits and `-`, starting and ending with a letter or digit. A handle another supplier holds, a vendor slug and a few reserved words are refused with `supplier_handle_taken`. The handle prefixes the id `handle/alias` of every model you declare and never changes. Registering accepts the standing terms of version 2, which `GET /v1/supplier` lists and which stay the terms on record for your handle: - Payment is capped at the cost of the reserved usage limits for the endpoint that serves the request. Usage above that cap is unpaid. - Your model mappings, operations, capabilities and limits must hold for every backend your endpoint uses. - Pools rely on your claims about models and prompt privacy; Compute Finance does not verify them. Reported usage is checked for consistency, not measured independently. - Each request includes the full conversation and asks your endpoint not to store it. Your endpoint must work without relying on stored history. - Payment requires valid usage in the response. A request is unpaid if the exchange stops it before usage arrives, including at its deadline or after receiving a client disconnect. **Connect.** `POST /v1/supplier/endpoints` takes a `label`, `baseUrl`, `authScheme` and `credential`. The base URL usually ends in `/v1`; the exchange appends `/chat/completions` or `/responses`. Use `BEARER` for an `Authorization: Bearer` credential or `X_API_KEY` for `x-api-key`. Credentials are encrypted and cannot be read back; use `PATCH` to replace one. Optional `concurrencyLimit`, `rpmLimit` and `tpmLimit` apply across all pools. **What the endpoint must do.** - Speak the OpenAI wire format at `{baseUrl}/chat/completions`, and at `{baseUrl}/responses` for a model that declares the Responses operation. Answer `stream: false` with one JSON document and `stream: true` with server-sent events, never one for the other. - Report usage with every answer: `usage` on a document, on the last chunk of a chat stream — the request asks for it with `stream_options.include_usage` — and on `response.completed`. Report the count of every cached or reasoning kind the price's `reportedUsageKinds` lists; an answer without valid usage is not paid. See [Money](https://docs.compute.finance/#private-money). - Serve HTTPS on a publicly trusted certificate, at a host that resolves only to public addresses. The base URL carries no user info, query or fragment, and redirects are not followed. The exchange calls from cloud egress with no fixed address, so an IP allowlist cannot admit it: the credential is the gate. - Keep a document, and each event of a stream, within 4 MiB and a whole stream within 64 MiB. A larger answer counts as a failed attempt before its first output; after it, it ends the stream with `stream_interrupted`. - Requests use `store: false` and include the conversation needed for the answer. The exchange replaces `user` and `prompt_cache_key` with keyed digests; prompt contents still reach your endpoint. - If your endpoint retries internally, it may report how many attempts it made in an `x-cf-upstream-attempts` response header; the count is recorded beside the exchange's own. **Declarations.** `POST /v1/supplier/endpoints/:id/models` declares one model together with its first price: the `alias` — lowercase letters, digits, `.` and `-`, at most 100 characters, never `auto`, live on one of your endpoints at a time — the `upstreamModel` your endpoint is sent, the operations it serves, each with its own capabilities, the `contextWindow`, the required `maxOutputTokens` — the most your model answers with; a client's lower limit is passed on, and usage reported far beyond the request's bound is not paid — and the `inputReserveRatio`, from 1 to 2 and 1.5 by default. The exchange counts a prompt with its own tokenizer and reserves that count times the ratio, so set it to how far your model's tokenizer can exceed that count. An endpoint holds at most 100 live declarations. | Operation | Name | Endpoint path and what it serves | | --- | --- | --- | | `chat_completions` | Chat Completions | `POST {baseUrl}/chat/completions`. Serves `/v1/chat/completions` and `/v1/messages`, and `/v1/responses` translated into chat completions. | | `responses` | Responses | `POST {baseUrl}/responses`. Serves `/v1/responses` natively: the endpoint's events are relayed and its encrypted reasoning carries between turns. | | Capability | Name | What it admits | | --- | --- | --- | | `tools` | Tool calls | On chat completions, a non-empty `tools`, any `tool_choice` other than `none`, or a tool turn; on Responses, a non-empty `tools`, a `tool_choice` other than `none` or `auto`, or a tool call or tool output in `input`. Validation forces one tool call. | | `structured_outputs` | Structured outputs | A JSON-schema or JSON-object `response_format`, or the same as `text.format` on Responses. Validation asks for an answer that follows a schema. | | `reasoning` | Reasoning | A request for reasoning — on chat completions a reasoning effort or a `reasoning` object that does not disable it, on Responses an effort other than `none`. Validation allows the answer more output tokens. | **Custom tool formats.** Under an operation with Tools enabled, select only the custom formats its endpoint actually supports: `text`, `lark` or `regex`. The API field is `operations[].customToolFormats`. Validation probes each declared format; changing the list creates a new declaration that pool owners must accept. Buyers see these formats for each operation in the pool model list and `GET /v1/models`. **Changing a model.** Changing its alias, upstream model, operations or capabilities requires a new passing connection test and pool-owner acceptance before it can serve again. Limits (`contextWindow`, `maxOutputTokens` and `inputReserveRatio`) can be updated without re-acceptance. `DELETE` retires the model. **Prices.** The app takes USD per million tokens. The API uses integer strings with 18 decimal places: `"600000000000000000"` means $0.60. The minimum is `"1000000000000"` ($0.000001). Up to 8 context tiers can set different input and output rates from a given input size. Rates for each token category: | Kind | Name | Rate | | --- | --- | --- | | `input` | Input | Required. | | `output` | Output | Required. | | `cachedInput` | Cache read | Follows the `input` rate of the request's tier. Listed in `reportedUsageKinds`, it may also take a rate of its own. | | `cacheWrite` | Cache write | Always the `input` rate of the request's tier: the OpenAI usage format does not itemise cache writes. | | `reasoningOutput` | Reasoning output | Follows the `output` rate of the request's tier. Listed in `reportedUsageKinds`, it may also take a rate of its own. | **Reported kinds.** List a kind in `reportedUsageKinds` exactly when your endpoint reports its count with every answer — `prompt_tokens_details.cached_tokens` and `completion_tokens_details.reasoning_tokens` on chat completions, `input_tokens_details.cached_tokens` and `output_tokens_details.reasoning_tokens` on Responses. A listed kind's count must be present in every report, or that answer goes unpaid; a count of a kind not listed stays inside its side and is billed at the side's rate, exactly as if it were not itemised. Listing a kind keeps it at its side's rate unless you also give it a rate of its own. The quickstart lists none, for an endpoint whose usage carries no cached or reasoning count, or only zeros — choose by what your backend reports. **Changing a price.** `PUT …/models/:modelId/prices` opens a new price version and closes the open one; every price answer lists the resolved rate of each kind below the first tier and at every tier, marked `own` or `follows`. A request is billed at the version it was reserved at. A pool keeps serving a new price that stays within the ceilings its owner accepted; a rate above a ceiling stops the model at the tiers it reaches (`price_above_ceiling`) until the owner raises the ceiling. **Test the connection.** `POST /v1/supplier/endpoints/:id/validate` sends short requests to check each declared operation and capability. All operations must pass before sharing. Failed checks show what to correct; `notChecked` lists checks left for another run. Each run allows 32 requests within 60 seconds. Wait at least 60 seconds between runs on an endpoint; account limits are 2 runs per minute and 20 per hour. A rate-limit response includes `Retry-After`. Tests use your endpoint's capacity, not your COMPUTE balance. Changing its URL, auth scheme or credential requires testing again. **Sharing.** The pool owner gives you the pool's id. `POST /v1/supplier/pools/preview` names the pool and its owner before you commit; `POST /v1/supplier/endpoints/:id/offers` with that `poolId` offers every live declaration of the endpoint as one pending offer and notifies the owner. Only a private pool takes offers (`offer_pool_public`), and an endpoint is offered to at most 20 pools at once. A disabled endpoint, one without a model and one with an operation not yet validated are refused, `details.reason` saying which. If you manage the pool yourself, `acceptWithDefaults: true` accepts in the same call, each ceiling at your highest rate of its kind. **Withdrawing and removing.** `DELETE …/offers/:offerId` withdraws an offer: an accepted one's models leave the pool at once and its owner is notified, while a pending one simply closes. Sharing again reopens it as pending. Disabling the endpoint (`PATCH` with `status: "DISABLED"`) pauses it in every pool, and `DELETE` removes it for good — the credential is erased, its models retire and its offers are withdrawn. What it already earned is still paid. **Earnings.** Billed usage earns your base rate in COMPUTE, within the accepted price limits and request cap. The buyer pays the 5% routing fee in addition. `GET /v1/supplier/earnings` summarizes earnings by model and pool (30 days by default, up to 90). `GET /v1/supplier/earnings/requests` lists individual requests and their payment status. Unbilled requests have no earnings and `payoutState: null`. Billed amounts progress through these states: | Payout state | Meaning | | --- | --- | | `unsettled` | No settlement batch has taken it up yet. | | `in_settlement` | A settlement batch has taken it up and has not been recorded as paid; a batch held for review stays here until it is resolved. | | `paid` | The batch that took it up has paid it to your wallet. | Set first: $CF_API, $CF_SESSION, $HANDLE, $ALIAS, $UPSTREAM_MODEL, $ENDPOINT_BASE_URL, $ENDPOINT_CREDENTIAL, $POOL_ID. **Supplier — register, connect, declare, validate, share** ```sh curl -sS "$CF_API/v1/supplier" \ -H "Authorization: Bearer $CF_SESSION" | jq -e '.standingTerms // halt_error' && jq -n --arg HANDLE "$HANDLE" '{ handle: $HANDLE, termsVersion: 2 }' | curl -sS -X POST "$CF_API/v1/supplier/handle" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -e '(.supplier // halt_error).handle' && ENDPOINT_ID=$(jq -n \ --arg ENDPOINT_BASE_URL "$ENDPOINT_BASE_URL" \ --arg ENDPOINT_CREDENTIAL "$ENDPOINT_CREDENTIAL" \ '{ label: "Primary", baseUrl: $ENDPOINT_BASE_URL, authScheme: "BEARER", credential: $ENDPOINT_CREDENTIAL, concurrencyLimit: 8, rpmLimit: 600, tpmLimit: 1000000 }' | curl -sS -X POST "$CF_API/v1/supplier/endpoints" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -er '.id // halt_error') && MODEL_ID=$(jq -n \ --arg ALIAS "$ALIAS" \ --arg UPSTREAM_MODEL "$UPSTREAM_MODEL" \ '{ alias: $ALIAS, upstreamModel: $UPSTREAM_MODEL, operations: [{ operation: "chat_completions", capabilities: ["tools"] }], contextWindow: 131072, maxOutputTokens: 8192, price: { input: "600000000000000000", output: "2400000000000000000", reportedUsageKinds: [] } }' | curl -sS -X POST "$CF_API/v1/supplier/endpoints/$ENDPOINT_ID/models" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -er '.id // halt_error') && curl -sS -X POST "$CF_API/v1/supplier/endpoints/$ENDPOINT_ID/validate" \ -H "Authorization: Bearer $CF_SESSION" | jq -e '.results // halt_error' && jq -n --arg POOL_ID "$POOL_ID" '{ poolId: $POOL_ID }' | curl -sS -X POST "$CF_API/v1/supplier/pools/preview" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -e '.name // halt_error' && OFFER_ID=$(jq -n --arg POOL_ID "$POOL_ID" '{ poolId: $POOL_ID }' | curl -sS -X POST "$CF_API/v1/supplier/endpoints/$ENDPOINT_ID/offers" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -er '.id // halt_error') ``` Set first: $CF_API, $CF_SESSION, $ENDPOINT_ID, $MODEL_ID, $OFFER_ID. **Supplier — last, after the buyer's chains: change the price, withdraw the offer** ```sh jq -n '{ input: "500000000000000000", output: "2000000000000000000", reportedUsageKinds: [] }' | curl -sS -X PUT "$CF_API/v1/supplier/endpoints/$ENDPOINT_ID/models/$MODEL_ID/prices" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -e '.id // halt_error' && curl -sS -X DELETE "$CF_API/v1/supplier/endpoints/$ENDPOINT_ID/offers/$OFFER_ID" \ -H "Authorization: Bearer $CF_SESSION" | jq -e '.status // halt_error' ``` ### Pool owners: admit offers 1. **Create a private pool.** Add the people who will use its models and send the Pool ID to your supplier. Membership lets people use models; it does not let them approve suppliers. 2. **Review the offer.** Open the pool's offers and check the supplier, models, capabilities and prices. Approve only suppliers you trust with the prompts sent to their models. 3. **Set your price limits and accept.** Choose the models and maximum supplier rates you allow, before the routing fee. A price above those limits stops that model from serving the affected requests. You can review new terms or revoke access at any time. #### Price limits and pool-owner API examples **Membership is not management.** Membership lets an account issue a key into the pool and spend on what the pool admits. Deciding what it admits — accepting, rejecting and revoking offers, and setting ceilings — takes the right to manage the pool: its owner's, and in an organization that of every role the [roles table](https://docs.compute.finance/#organizations) allows to manage pools. Supply stays personal: a supplier offers their own endpoint whatever organization they act in. **A private pool.** Only a private pool takes offers. Create one with `isPublic: false`, add members by the email on their profile, and give suppliers its id. A pool with a pending or accepted offer can be neither made public nor deleted, and removing a member revokes every key they hold in the pool in the same step. **Review an offer.** `GET /v1/pools/:id/offers` shows the supplier, models, capabilities, connection-test results, limits and prices. The endpoint URL and credential stay private. `GET /v1/pools/:id/models` shows accepted models and buyer prices. **Accept models and prices.** Read the offer at `GET /v1/pools/:id/offers/:offerId`, then send selected model ids, their current `priceVersionId` and per-category ceilings to `PUT /v1/pools/:id/offers/:offerId/terms`. Each ceiling must cover that category's highest current rate across all tiers. The app defaults to those rates; the example below accepts every live model. A pool supports up to 20 accepted offers. Price-limit fields: | Ceiling | Name | | --- | --- | | `input` | Input | | `output` | Output | | `cachedInput` | Cache read | | `reasoningOutput` | Reasoning output | **Changing price limits.** To change ceilings or the selected models, send the complete model list to the same `PUT` route, using each current `priceVersionId`. A stale price returns `409 offer_changed`; reload and review the offer before accepting again. The example below accepts all current rates, including increases: edit `$TERMS` first to retain your own ceilings. **Revoking and rejecting.** An empty list, or `DELETE …/terms`, revokes an accepted offer: its models leave the pool at once. `POST …/reject` declines a pending one, whose models never served the pool. The supplier is notified of either. Set first: $CF_API, $CF_SESSION, $MEMBER_EMAIL. **Pool owner — create the pool, add a member** ```sh POOL_ID=$(jq -n '{ name: "Research", isPublic: false }' | curl -sS -X POST "$CF_API/v1/pools" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -er '.id // halt_error') && jq -n --arg MEMBER_EMAIL "$MEMBER_EMAIL" '{ email: $MEMBER_EMAIL }' | curl -sS -X POST "$CF_API/v1/pools/$POOL_ID/members" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -e '.id // halt_error' ``` Set first: $CF_API, $CF_SESSION, $POOL_ID, $OFFER_ID. **Pool owner — accept every live model of an offer at its rates** ```sh TERMS=$(curl -sS "$CF_API/v1/pools/$POOL_ID/offers/$OFFER_ID" \ -H "Authorization: Bearer $CF_SESSION" | jq -ec '[ (.models // halt_error)[] | select(.retired == false) | { endpointModelId: .endpointModelId, priceVersionId: .price.id, ceilings: { input: ([.price.rates.input.usd18PerM, .price.tiers[].rates.input.usd18PerM] | max_by([length, .])), output: ([.price.rates.output.usd18PerM, .price.tiers[].rates.output.usd18PerM] | max_by([length, .])), cachedInput: ([.price.rates.cachedInput.usd18PerM, .price.tiers[].rates.cachedInput.usd18PerM] | max_by([length, .])), reasoningOutput: ([.price.rates.reasoningOutput.usd18PerM, .price.tiers[].rates.reasoningOutput.usd18PerM] | max_by([length, .])) } } ]') && jq -n --argjson TERMS "$TERMS" '{ models: $TERMS }' | curl -sS -X PUT "$CF_API/v1/pools/$POOL_ID/offers/$OFFER_ID/terms" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -e '.status // halt_error' ``` ### Buyers: call a private model 1. **Join the pool.** Ask its owner to add you. Create an API key for that pool and make sure the paying account has enough COMPUTE. 2. **Choose an available model.** Open the pool's models, or call `GET /v1/models` with your key. Use its full `handle/alias` id and check that it supports the operations and tools your app needs. 3. **Connect your app.** Use your pool key with the [Inference API](https://docs.compute.finance/#inference-api), or follow the [Codex setup](https://docs.compute.finance/#private-codex) below. Your supplier's credential is not needed. #### Model discovery, request examples and troubleshooting **A key in the pool.** Issue a key with the pool's id as `poolId`; a key's pool is fixed for its life. Only the pool's owner and members can — anyone else gets `404 not_found`, the answer for a pool that does not exist. Removing a member revokes every key they hold in the pool, so their next request answers `401 api_key_revoked`, and adding them back restores none: they issue a new key. **Find a model with your pool key.** `GET /v1/models` includes the public catalogue and your pool's accepted private models. For a private model, check its `id` (`handle/alias`), `operations`, `admittedInputTokens` and `maxOutputTokens`. `pricing.buyer` is USD per million tokens including the routing fee; `pricing: null` means no price is accepted. `eligibleUpToInputTokens` is `null` if price ceilings impose no input-size bound, `0` if no size is admitted, or the largest reserved input size allowed by the ceilings. Model context limits and each operation's availability still apply. Availability checks and cost estimates use the same key and pool. **Calling one.** Name it as `model` on `/v1/chat/completions`, `/v1/messages` or `/v1/responses`. The answer's `model` and `X-Model-Used` carry the `handle/alias`, and `X-Provider` the handle. A bare model name is always a catalogue model, never an alias, and `auto` chooses among catalogue models only. A private model never falls back on its own: a request reaches another model only through a `models[]` list that names it — on `/v1/chat/completions` and `/v1/messages`; `/v1/responses` serves exactly the model it names — and a catalogue model in that list is served by the catalogue capacity the pool reaches — the provider keys its owner and members deposited — so every fallback is one you wrote. Set first: $CF_API, $CF_SESSION, $POOL_ID. **Buyer — a key in the pool** ```sh CF_API_KEY=$(jq -n --arg POOL_ID "$POOL_ID" '{ label: "codex", poolId: $POOL_ID }' | curl -sS -X POST "$CF_API/v1/keys/create" \ -H "Authorization: Bearer $CF_SESSION" \ -H "Content-Type: application/json" \ -d @- | jq -er '.rawKey // halt_error') ``` Set first: $CF_API, $CF_API_KEY, $MODEL. **Buyer — the pool's model in GET /v1/models** ```sh curl -sS "$CF_API/v1/models" \ -H "Authorization: Bearer $CF_API_KEY" | jq -e --arg MODEL "$MODEL" '[(.data // halt_error)[] | select(.id == $MODEL)]' ``` **A tool-using turn.** The exchange keeps no conversation, so every request carries the whole history. The first call below declares a tool, names it in `tool_choice` and sets `parallel_tool_calls: false`, so the model returns exactly one `function_call`, which the chain keeps — it stops, printing the calls, on none or several; the second sends the history with that call and a `function_call_output` under its `call_id`, and gets the answer. On `/v1/chat/completions` the same turn is an assistant message with `tool_calls` followed by a `tool` message. Set first: $CF_API, $CF_API_KEY, $MODEL. **Buyer — a tool-using turn on /v1/responses** ```sh CALL=$(jq -n --arg MODEL "$MODEL" '{ model: $MODEL, input: [ { type: "message", role: "user", content: "What is the weather in Paris? Use the tool." } ], tools: [ { type: "function", name: "get_weather", description: "Current weather for a city", parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"], additionalProperties: false } } ], tool_choice: { type: "function", name: "get_weather" }, parallel_tool_calls: false }' | curl -sS -X POST "$CF_API/v1/responses" \ -H "Authorization: Bearer $CF_API_KEY" \ -H "Content-Type: application/json" \ -d @- | jq -ec '[(.output // halt_error)[] | select(.type == "function_call")] | if length == 1 then .[0] else halt_error end') && jq -n \ --arg MODEL "$MODEL" \ --argjson CALL "$CALL" \ '{ model: $MODEL, input: [ { type: "message", role: "user", content: "What is the weather in Paris? Use the tool." }, $CALL, { type: "function_call_output", call_id: $CALL.call_id, output: "{\"temperature_c\":18,\"sky\":\"clear\"}" } ], tools: [ { type: "function", name: "get_weather", description: "Current weather for a city", parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"], additionalProperties: false } } ] }' | curl -sS -X POST "$CF_API/v1/responses" \ -H "Authorization: Bearer $CF_API_KEY" \ -H "Content-Type: application/json" \ -d @- | jq -e '.output // halt_error' ``` **A model outside your pool.** `GET /v1/models` omits it, and calling it answers `422 validation_failed` with `Unknown vendor "$HANDLE" in "$MODEL"` — exactly what a model that does not exist gets, so no answer reveals another pool's supply. A key issued in another pool answers this way, as do a model of an offer the pool never accepted, one declared after the pool's last acceptance ended, and one retired before that acceptance began. A model declared before an accepted offer closed, and a changed model waiting for acceptance, stay listed and answer `422 offer_unavailable` with `details.reason`. Check the key's pool before the handle. **When a model cannot serve.** `availability` on `GET /v1/models` and on the pool's offers, and `details.reason` of `422 offer_unavailable`, take these values. A model's own `availability` reads `available` only while every operation it declares can serve; otherwise read `operations[].availability` for the operation you call, which serves while it reads `available`. `details.actor` names who has to act first: | Value | Meaning | Who acts | | --- | --- | --- | | `available` | Available | — | | `awaiting_acceptance` | Awaiting pool approval | Pool owner | | `price_above_ceiling` | Price exceeds pool limit | Pool owner | | `endpoint_disabled` | Endpoint disabled | Supplier | | `endpoint_removed` | Endpoint removed | Nobody — a removed endpoint never serves again | | `model_retired` | Model retired | Supplier | | `offer_closed` | Offer closed | Supplier | | `validation_failed` | Connection check not passed | Supplier | | `cooldown` | Temporarily paused after errors | Supplier | For `offer_unavailable`, check `details.reason` and `details.actor`. Closed offers need a new agreement; changed models need pool-owner acceptance. For `rate_limited`, `details.scope` identifies an endpoint or pool limit. Unsupported operations or history need a request change; `history_unavailable` requires the original model and endpoint or a new conversation. See [Errors](https://docs.compute.finance/#inference-errors) for the full reference. ### Codex Codex CLI 0.166.0 uses a compatible private model over `/v1/responses`. Put this provider setup in `~/.codex/config.toml`, replace the example model id with yours from `GET /v1/models`, and set the input window as described below. Export the key as `CF_API_KEY` before running `codex`: **~/.codex/config.toml** ```toml model_provider = "compute" model = "/" web_search = "disabled" [model_providers.compute] name = "Compute Finance" base_url = "https://api.compute.finance/v1" env_key = "CF_API_KEY" wire_api = "responses" ``` - `model` names the model by its `handle/alias` id. `auto` is refused on `/v1/responses`, and a bare name is a catalogue model. - The provider's `name` is anything but `OpenAI`, which switches Codex to behaviour only OpenAI's own API supports; `wire_api = "responses"` is the only wire Codex speaks. - `web_search = "disabled"`: by default Codex adds a hosted web-search tool, which the exchange does not run and refuses (`operation_unsupported`). - Before running Codex, read the selected model from `GET /v1/models` using your API key. Add `model_context_window` at the top level of `config.toml`, before `[model_providers.compute]`, and set its integer value to the private model's `admittedInputTokens`. For a catalogue model, use its published `maxInputTokens`, or the backend's verified input limit if none is published. Update this value when changing models. Codex compacts at 90% of its selected window; use `/compact` to reduce a conversation that reaches `context_length_exceeded`. #### Model compatibility and client behavior - This provider setup does not automatically enable tool search in Codex. Use tool search with a client that sends `tool_search` with `execution: "client"` and handles discovery results. The request and continuation steps are under [Responses API](https://docs.compute.finance/#inference-responses). - Leave `model_reasoning_effort` unset, or set it to `none`, which every model accepts; any other effort needs a model whose operation declares reasoning, and on a model served over chat completions is one of none, low, medium, high. - A model served through Chat Completions emits no reasoning. Codex may select custom tools such as `apply_patch` from its own model metadata. Choose a model whose serving operation advertises the required format in `customToolFormats` from `GET /v1/models`; a grammar-based tool needs its grammar format, not just text support. The exchange preserves the tool input and grammar over mapped Chat Completions or native Responses. Accepted tools and input items are listed under [Responses API](https://docs.compute.finance/#inference-responses). - A session that replayed reasoning a natively served model produced continues only on that model and its endpoint: any other model or endpoint answers `history_unavailable`. Start a new session to switch. - `/compact` and `/review` use billable inference requests. Review uses `review_model` if set, otherwise `model`. - Codex resends retryable requests with the retained conversation history, up to `stream_max_retries` (5 by default). This includes a mid-stream `response.failed` carrying `stream_interrupted`. A tool call may already have run locally before the interruption; another call produced after a resend can repeat its effects. Check local changes before manually retrying a failed task. Each resend is a separate inference request subject to the normal reservation and usage-billing rules. An output-limit `response.incomplete` stops the request rather than triggering this retry loop, so choose a model whose `maxOutputTokens` fits your tasks. - Leave `supports_websockets` unset. Use HTTP; the exchange does not support WebSocket inference. ### History, retries and privacy - **Send the history with each turn.** The exchange does not store conversations. `previous_response_id`, `store: true` and `item_reference` are unsupported. Requests to the supplier use `store: false`. - **Switching models.** Messages and tool results can move between models. Encrypted reasoning can only continue on the model and endpoint that created it; otherwise the API returns `history_unavailable`. Start a new conversation to switch. - **Interrupted responses.** Compute Finance can retry before the first output, but never after text or a tool call reaches the client. A stream that ends too early returns `stream_interrupted`. An output-limit response (`finish_reason: "length"` or `response.incomplete`) stops normally at that limit. Your client may make a new request after an interruption; check completed tool actions before retrying. See [Codex](https://docs.compute.finance/#private-codex) for its automatic resend behavior. - **Supplier privacy.** The supplier receives the prompts sent to its models. Compute Finance checks compatibility and usage reports, but does not independently verify model identity or the supplier's data practices. Choose a supplier you trust. ### Pricing and payments - **Prices in USD, payment in COMPUTE.** The supplier's price and the USD-to-COMPUTE conversion rate are fixed for each request. Changes during the request do not change its bill. - **Routing fee: 5%.** Prices shown to buyers already include the fee. Suppliers earn their base rate. - **Maximum charge.** Before sending your request, Compute Finance reserves enough for the most expensive permitted route, including the routing fee. The final charge cannot exceed the serving model's reserved cap. Set an output limit to control how much a request can spend. - **Pool price limits.** A model can serve only at rates within the limits accepted by the pool owner. The routing fee is added to those supplier rates. You pay for valid usage the supplier reports; unused reserved funds return to your balance. #### Billing outcomes and request receipts **Usage bounds.** Each reported count is a whole number no greater than 2,147,483,647, and input and output together stay within that limit. The input may be at most 1.1 × the model's context window, and the output at most 1.1 × the request's output limit. **Incomplete or invalid usage.** Missing, inconsistent or out-of-bounds usage is not estimated or billed. The reservation is released and the supplier sees the reason in earnings. Valid usage received before a stream interruption can be billed; stopping a client does not guarantee that the upstream request stops. For non-streaming responses, `X-Compute-Used` is the final charge. Chat streams send this header before completion as the reserved amount; use final `x_credits_used` for the settled charge. Responses streams report usage on their terminal event, with `usage: null` when unbilled. An interrupted stream ends with `stream_interrupted` rather than a settled final result. The earnings record shows one of these outcomes: | Outcome | Meaning | | --- | --- | | `BILLED` | Billed | | `BILLED_AT_CAP` | Billed at the request limit | | `UNBILLED_METERING_ERROR` | Not billed: invalid usage report | | `UNBILLED_INTERRUPTED` | Not billed: interrupted before usage arrived | For help with a request, keep its `X-Request-Id`. Never send a credential or prompt to support. Buyers see billed usage; suppliers also see unpaid requests and the reasons they were not billed. --- ## Integration contracts How a model is named and chosen, which API answers which question, and what a request costs in `$COMPUTE` — the rules the running system enforces, in one place. The wire-format detail behind each stays in the section it belongs to. ### Model identifiers and selection **The identifier.** `GET /v1/models` publishes the routable catalogue in OpenAI wire format: ```json { "object": "list", "data": [ { "id": "openai/gpt-5.5", "object": "model", "created": 1776902400, "owned_by": "openai", "displayName": "GPT-5.5", "maxInputTokens": 1048576 } ] } ``` Every `id` has the form `vendor/model` and is the identifier the Inference API routes and bills on; `owned_by` carries the same vendor slug the prefix uses. Pass it as `model`, or as an entry of the `models[]` fallback list. The bare model name is accepted in both places, so `x-ai/grok-4.5` and `grok-4.5` reach the same model; the match is case-insensitive, and an unknown vendor prefix, or a real model named under the wrong vendor, is rejected rather than resolved by guess. `GET /v1/oracle/resolve/{key}` answers what a spelling resolves to before you send it. **A supplier's model.** Under a key issued into a private pool, `GET /v1/models` also lists the models that pool admits from suppliers, each as `handle/alias` — the supplier's handle, then the model's alias. Such an id resolves only under a key of that pool and answers anyone else as an unknown model, and a bare name never resolves to one; see [Private endpoints](https://docs.compute.finance/#private-endpoints). **`auto`.** Omitting `model`, or setting it to `auto`, hands the choice to the exchange: it serves a model from the operator's ordered preference list, among the entries with serving capacity — send `conversation_id` to group the turns of one conversation, so the exchange keeps serving them from the same capacity. When that list is empty, or nothing on it can serve, the choice falls through to the cheapest model that can rather than refusing every buyer over an operator setting; a list that can serve nothing also raises an operator alert. That value is a routing directive and never a catalogue id — it takes no vendor prefix and may not appear inside `models[]`. When no model has capacity the request is refused with `503` rather than served by something the caller did not choose, and `GET /v1/models/availability` names the model `auto` resolves to from that list right now. **`routing_bias`.** An optional `cheaper` / `balanced` / `better`, defaulting to `balanced`, that leans an `auto` choice toward the cheaper or the stronger end of the operator's list. It is a bias and not a service level — it influences which model is picked and promises neither a price nor a quality. Sending it beside a named `model`, or beside a `models[]` list, is refused with `422 validation_failed`: both spend the choice the dial exists to lean. It reaches that choice only where the exchange made one for the request, which `X-Model-Chooser` names — `engine` and `pin` carry the bias, while `list` and `degraded` mean the operator's order served and the dial did not act. Changing the value releases the model a `conversation_id` was being served from, so the next turn is chosen afresh. `GET /v1/inference/estimate` takes the same dial and runs the same choice, so a quote can be leaned exactly as the request it stands for. **Your own fallback list.** Send `models` — an ordered list of 1 to 8 model ids — catalogue ids and, under a key of a private pool, its `handle/alias` ids; `model`, when present, is tried first, then each entry in turn. An entry lacking capacity or a requested capability is skipped, the request is billed at the model that answered, and the hold covers the costliest listed entry with the excess released at settlement. Combining a list with `model: "auto"` is rejected. Fall-through covers capacity and capability only: a prompt above an entry's context window, or a parameter that entry rejects as invalid, aborts the request instead of moving to the next candidate. **No silent substitution.** A named model is served or the request fails — the exchange never swaps it for another. Substitution happens only where the caller asked for it: an entry of the `models[]` list, or `auto`. Every answer says which model produced it — `X-Model-Used` names the model that ran, `X-Model-Requested` the one the exchange set out to serve, and `X-Fallback-Used` reads `true` exactly when the two differ. A named model outside a key's `allowedModels` is refused with `403 model_restricted` rather than swapped for one the key may reach. **Parameters.** What each wire format does with every parameter it is sent — take it, refuse it, or drop it under a published policy — is listed under **Wire-format compatibility deltas** above. ### Which API answers what Two products share one host. The Inference API is paid, takes a `ct_live_*` key, and serves the models that can run a request. The Oracle API is free, unauthenticated and read-only, and publishes prices and the index over a catalogue that is a superset of the routable set — a model can be priced there and not be routable here. | Question | Ask | |---|---| | Which models may I name? | `GET /v1/models` | | Which of them can serve right now? | `GET /v1/models/availability` | | What does this spelling resolve to? | `GET /v1/oracle/resolve/{key}` · `GET /v1/oracle/resolve?keys={csv}` | | What will this request cost? | `GET /v1/inference/estimate` | | What rates am I billed at? | `GET /v1/oracle/pricing` | | What do the vendors charge? | `GET /v1/oracle/models` · `GET /v1/oracle/catalog` | | What is compute worth, now and over time? | `GET /v1/oracle/scu` · `GET /v1/oracle/history` | | What have I spent, and what is left? | `GET /v1/usage` | **Markup is where the two price lists differ.** Every figure on `GET /v1/oracle/pricing` already carries the routing markup, cache and reasoning components included, so it matches what a request is charged. `GET /v1/oracle/models` and `GET /v1/oracle/catalog` publish the vendors' own list prices without it, and `/v1/oracle/models` and `/v1/oracle/basket` carry the marked-up pair alongside as `markedUpUsdPricePerMillion` and `markedUpWeiPricePerMillion`. Read a number against the endpoint it came from; the two lists are not interchangeable. ### What a request costs Tokens are split by kind, and the kind picks the rate. The catalogue prices each kind separately on the models that support it; a kind a model does not price separately is billed at its side's rate — cache components at `input`, reasoning output at `output`. | Kind | Counts | |---|---| | `input` | Prompt tokens the provider read fresh. | | `output` | Tokens the model generated, thinking tokens included. | | `cachedInput` | Prompt tokens served from a cache hit. | | `cacheWrite5m` | Prompt tokens written into a 5-minute cache entry. | | `cacheWrite1h` | Prompt tokens written into a 1-hour cache entry. | | `reasoningOutput` | Thinking tokens, on a model that prices them apart from ordinary output. | **The arithmetic.** Each kind's token count is charged at its own rate per million tokens. On a model with a context-tier ladder, the whole input side of the request — prompt plus cache reads plus cache writes — picks the tier the `input` and `output` rates are read from. The legs are summed, the 5% routing markup is applied to that sum exactly once, and the result is divided by the `$COMPUTE` peg to reach the debit. Settlement re-runs the same arithmetic on the token counts the provider reported, and that is the bill; the reservation only decides how much was held. The provenance mark a catalogue price carries plays no part in this arithmetic — `GET /v1/oracle/catalog` above defines what it records. ``` # Catalogue rates for openai/gpt-5.5 — GET /v1/oracle/catalog input $5.00 per 1M tokens output $30.00 per 1M tokens # Peg — GET /v1/oracle/pricing pegUsd 73.733841 USDC per 1 $COMPUTE input leg 1000 / 1e6 x 5.00 = $0.005 output leg 500 / 1e6 x 30.00 = $0.015 subtotal = $0.020 routing markup x 1.05 = $0.021 ÷ peg / 73.733841 = 0.00028480816562913085 $COMPUTE ``` ```json { "model": "openai/gpt-5.5", "resolvedModel": "openai/gpt-5.5", "promptTokens": 1000, "completionTokens": 500, "creditsCost": 0.00028480816562913085, "creditsWei": "284808165629131", "usdCost": 0.020999999999999998, "reservedWei": "284808165629131", "tierFromInputTokens": null } ``` Catalogue prices and the peg both move, so the figures above are illustrative — `GET /v1/inference/estimate` is the quote that is always current, and its `reservedWei` is the hold the charge comes out of. --- [Disclaimer](https://compute.finance/disclaimer) | [Terms](https://compute.finance/terms) | [Privacy](https://compute.finance/privacy) | [Cookies](https://compute.finance/cookies) [X](https://x.com/computefin) | [LinkedIn](https://linkedin.com/company/compute-finance)