decentramind
Buy credits

Docs

API reference and agent guide.

An OpenAI-compatible API over OpenRouter and Chutes, paid from a balance your wallet activates on-chain.

Quickstart

  1. Buy credits on the home page (or activate credits you hold on your Dashboard).

  2. Create your key on the Dashboard.

  3. Point any OpenAI-compatible client at the base URL:

OPENAI_BASE_URL=https://<this site>/api/v1
OPENAI_API_KEY=sk-dm-…

API keys

A key is sk-dm-<n>-<key>, where <key> is your wallet's 32-byte public key followed by its 64-byte Ed25519 signature of the message Decentramind API key · <this site> · solana:<cluster> · program <program> · epoch <n>, base64url-encoded. The message names this site, network and program, so a signature made anywhere else is not a key here. The gateway checks the signature on each request; nothing about the key is stored.

Send it as Authorization: Bearer sk-dm-… (or X-Api-Key). Signing a higher epoch rotates the key: the first request made with it makes every lower epoch invalid.

Endpoints

MethodPathWhat it does
GET/modelsThe catalog in OpenAI's list shape, with per-token prices, context, and zero_data_retention, decentralized and tee flags. No key needed.
POST/chat/completionsChat completions, streaming or not.
GET/keyThe key's wallet, epoch and balance in USD: available, credited, used, reserved.
GET/auth/keyThe same balance in OpenRouter's shape (limit_remaining), for clients that already read it.
POST/activations{ "signature": "…" } credits the activations in that transaction right away. Without a body it scans for new ones. No key needed.

All paths are relative to https://<this site>/api/v1.

Chat completions

The body is OpenAI's. model is an OpenRouter id such as anthropic/claude-sonnet-5, or chutes/<id> for Bittensor subnet 64 models such as chutes/moonshotai/Kimi-K3-TEE. Streaming, tools, images and response_format pass through.

  • Without max_tokens, output is capped at what the balance can pay for. max_tokens and max_completion_tokens are both sent as that cap.

  • Only the standard chat fields are forwarded. Others, such as models, route, plugins, prediction, web_search_options and user, are dropped: they could route to another model or add cost the hold does not cover. n must be 1, tools must be functions, and content parts must be text or images.

  • Up to 60 requests a minute per wallet.

  • OpenRouter requests are pinned to zero-data-retention endpoints.

  • The response is the provider's own, unchanged. Every response carries X-Decentramind-Balance and X-Decentramind-Request-Id.

curl https://<this site>/api/v1/chat/completions \
  -H "Authorization: Bearer $DECENTRAMIND_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/claude-sonnet-5","stream":true,"messages":[{"role":"user","content":"Hello"}]}'

Billing

Before forwarding, the gateway holds the most the request could cost: one token per byte of prompt, a fixed allowance per image, and the maximum output, at the model's dearest prices. After the answer it settles at the provider's own reported cost (OpenRouter) or at the listed per-token price on the usage the provider returned (Chutes), never above the hold, and releases the rest. An interrupted OpenRouter stream is settled from OpenRouter's generation record once it exists; a request cut off with no cost to read (a dropped connection on Chutes, say) is charged its hold.

Errors

Errors use OpenAI's shape: { "error": { "message", "type", "code" } }.

StatusCodeMeaning
400unsupported_parameter, unsupported_contentn above 1, a non-function tool, audio output, or audio, video or file content.
401invalid_api_key, key_rotatedMalformed or unverifiable key (keys made before they named this site no longer work), or a newer epoch is in use.
402insufficient_balanceThe balance cannot hold this request. Lower max_tokens or activate more.
404model_not_foundThe model is not in the catalog.
413too_largeThe body is over 8 MB.
429rate_limitOver 60 requests in a minute for this wallet.
429 / 502upstream_errorThe provider failed or rate-limited. Nothing is charged for a failed request.

MCP server

A remote MCP server (Streamable HTTP) at https://<this site>/api/mcp, authenticated with the same key and billed to the same balance. Tools: models (search the catalog), ask (send a prompt to any model) and balance.

claude mcp add --transport http decentramind https://<this site>/api/mcp \
  --header "Authorization: Bearer sk-dm-…"

For agents

A plain-text version of this guide is at /agents.md, and an index at /llms.txt. An agent with a wallet can do the whole loop itself: buy on-chain, sign its key, and call the API.

Buying on-chain

On Solana mainnet (addresses appear at launch):

Program—
Order book—
Credit mint (Token-2022)—
USDC—
  1. Read the book account and walk its asks cheapest first (FIFO within a price): the sum of each fill's cost, rounded up, is the USDC that buys your credits (6 decimals).

  2. Send buy_and_activate(payment_in, min_credit_out, beneficiary, max_fills). It fills from the cheapest asks, takes the USDC from your account and burns the credits into beneficiary's API balance in one transaction. It fails, and nothing moves, if fewer than min_credit_out credits would be bought.

  3. POST https://<this site>/api/v1/activations with { "signature": "…" } credits the balance at once (it is also picked up on the next scan).

A wallet that already holds credits can send activate(amount) instead, then step 3.