Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: mtok.market Bids API
version: 0.1.0
description: 'Spot market for AI inference tokens. Continuous double auction per model; input and output tokens are priced separately (USD per million tokens). NON-CUSTODIAL and SELLER-HOSTED: the platform never vaults a key, never proxies inference, and never holds money - it matches, verifies on-chain payments, prices, and tracks reputation. Delivery is always seller-hosted (tier:"direct"): the seller runs THEIR OWN relay pointed at an upstream they control, and buyers pay bounded draws in USDC on Base. Each draw goes through the MtokDripLedger contract (/config.dripContractAddress) and the relay requires the DrawPaid event before upstream delivery; the canonical delivered tape is GET /chain/draws. Every live draw is paid in USDC; every participant needs a funded EVM wallet on Base with USDC plus gas (there is no no-wallet path). Buying: register (with a pubkey for signed orders), fund a wallet, bid a block and read routes[] (the crossing seller-hosted offers) - or read /book for a tier:direct offer - GET /config, then pay each draw through MtokDripLedger and draw from the seller relayEndpoint (POST /chunk; the relay verifies DrawPaid and serves report-free), then affirmDraw/disputeDraw on-chain. The SDK''s drawFromSeller runs the loop; ensureFundedFor surfaces the human fund-relay when short. Selling: set up an inference upstream, run mtok-relay pointed at it over public HTTPS, and post a tier:direct offer at a positive price; your relay serves report-free (the platform indexes every draw from MtokDripLedger events). The platform does not gate paid offers by model license in the current launch config; sellers are responsible for the right to sell what they list, and /api/models/licenses is best-effort guidance only. Production uses Durable Object state; on-chain payment verification is wired for the direct-tier flow. Buyers can import the viem-bundled client at https://mtok.market/sdk.mjs (zero install) and call buy({model,budget,prompt}); the zero-dependency https://mtok.market/client.mjs covers discovery + signed orders without on-chain. Sanctions screening: requests from configured blocked countries are rejected at the request edge (403 geo_blocked), and settlement/payer wallets are screened against the configured sanctions address list at order time and payment time (403 sanctioned_address); both are terminal - do NOT retry.'
servers:
- url: /api
- url: https://mtok.market/api
tags:
- name: Bids
paths:
/bids:
get:
summary: All open bids
responses:
'200':
description: Bids
'503':
description: 'chain_index_rebuilding: the durable chain projection or a transaction-paged block is incomplete. Retry shortly.'
tags:
- Bids
operationId: getBids
x-operation-id-source: derived
post:
summary: Buy a block of capacity (input + output, priced/capped separately).
security:
- apiKey: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- model
- inputTokens
- outputTokens
- maxInputPricePerMTok
- maxOutputPricePerMTok
properties:
model:
type: string
inputTokens:
type: integer
minimum: 1
outputTokens:
type: integer
minimum: 1
maxInputPricePerMTok:
type: number
exclusiveMinimum: 0
description: Max USD/MTok you'll pay for input, must be > 0 (price-0 / max-0 is banned). The bid returns routes[] and you pay the seller per chunk on-chain (you ALWAYS need a funded wallet on Base; there is no no-wallet path).
maxOutputPricePerMTok:
type: number
exclusiveMinimum: 0
description: Max USD/MTok for output, must be > 0 (price-0 / max-0 is banned). Must be positive (see maxInputPricePerMTok).
maxStartDelaySeconds:
type: number
minimum: 0
maximum: 604800
default: 0
description: Also match offers whose usable window opens within this delay (0 = only currently-usable offers)
priceOn:
type: string
enum:
- input
- output
description: 'Rank the returned routes[] by a single dimension: ''input'' (cheapest input price first) or ''output'' (cheapest output price first). Omit to rank by blended input+output cost.'
expiresInSeconds:
type: number
default: 3600
maximum: 86400
responses:
'201':
description: '{order, tradeIds, fills, routes[]}; each route includes offerId, sellerId, relayEndpoint, settlementPubkey, optional signed requestHashScheme, inputPricePerMTok, outputPricePerMTok, availableInputTokens, availableOutputTokens'
'400':
description: Validation error
'401':
description: Missing/invalid x-api-key
tags:
- Bids
operationId: postBids
x-operation-id-source: derived
/bids/{id}:
delete:
summary: Cancel an open bid (owner only)
security:
- apiKey: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Cancelled
tags:
- Bids
operationId: deleteBidsById
x-operation-id-source: derived
components:
securitySchemes:
apiKey:
type: apiKey
in: header
name: x-api-key