DIM · Dagon Inference Marketplace

The listing document

GET /.well-known/inference-marketplace.json returns your signed listing. It is the only thing a buyer, prober or indexer needs to trust your routes, and the gateway builds and signs it from gateway.json at startup. You never write it by hand.

The envelope

Every signed JSON document in DIM has the same shape:

{ "doc": { ... }, "sig": base64(Ed25519 signature), "key": base58(public key) }

The signature is Ed25519 over SHA256("IM/JSON/1\0" ‖ jcs(doc)), where jcs is RFC 8785 canonical JSON. Whitespace and key order in the served bytes therefore do not matter; every value does. All numbers are integers in [0, 2^53 − 1]: floats, negatives and larger values are rejected by every parser in the system.

A real listing

This listing was produced by the gateway's own route code for the configuration in gateway setup, with throwaway example keys. It verifies.

{
  "doc": {
    "v": 1,
    "seller_id": "GUUbVoGEge8fGv6GfZtqRfCCCxRzX7NAcDF1EjeinYMA",
    "receipt_keys": [
      { "key": "CQeVjavdSiBzQ1X27Lcggr1LeXKFgDp66NdufptBDdWx", "key_epoch": 0 }
    ],
    "routes": [
      {
        "route_id": "a19636a556af82613e788bb2e7c32d084902d99b1f04ede436642d90b819f245",
        "nonce": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
        "model_identity": {
          "family": "llama-3.3-70b-instruct",
          "revision": "WEIGHTS_REVISION",
          "quantization": "fp8",
          "serving": { "engine": "vLLM", "engine_version": "0.8.5", "gpu": "NVIDIA H100 80GB", "gpu_count": 2, "max_concurrency": 64 }
        },
        "model_identity_id": "5bc5a04f7ae87f1f1856a8ca503c6ac08ed69b40dcf082495a4e1f666ab1f7fd",
        "endpoint": "https://gpu.example.com/v1/chat/completions",
        "schedule": {
          "v": 1, "currency": "USDC", "unit": "micro-USDC",
          "rates_per_mtok": { "input": 600000, "cached_input": 150000, "output_visible": 1800000, "output_hidden": 1800000 },
          "per_request_fee": 50, "w_req_micros": 2000, "ack_timeout_ms": 5000,
          "ttft_max_ms": 4000, "failure_billing": "none", "effective_from": 0
        },
        "schedule_digest": "1197c98bfbd0a6bb1f02e70fcc2f746ecf6ef3fd5b7a445a7cfc2e9ba9180f49",
        "policy": { "zdr": true, "region": ["us-east"] },
        "settler": "4DdSZHGBQpxkZjJv7zZf2mMcaNuKhFGSBNRp3iGQV4cw",
        "payout_token": "9UfBpKRhyHp36Etq2kdu2YieLgMV2YFijyZxZeAgfJBX",
        "receipt_key": "CQeVjavdSiBzQ1X27Lcggr1LeXKFgDp66NdufptBDdWx",
        "key_epoch": 0
      }
    ]
  },
  "sig": "W3Rk4KlP7FRaOKTl3+YTHhGSJ3Xlx+6dPwypPjkV0D6kdn+6KKN6OgQSkrnsmfuGiTtRV6vrK7z5iDhm+vUYAw==",
  "key": "GUUbVoGEge8fGv6GfZtqRfCCCxRzX7NAcDF1EjeinYMA"
}

Field by field

Field Meaning Where it comes from
v Listing version, always 1. Gateway
seller_id Your listing public key. Must equal the envelope key. listingKeyFile
receipt_keys Every receipt key a buyer should accept, each with a key_epoch. Receipts are accepted only under a key and epoch listed in the currently signed listing (A14). receiptKeyFile, nextReceiptKeyFile, retiredReceiptKeys
routes[].route_id SHA256(jcs({seller_id, endpoint, model_identity_id, nonce})), lowercase hex. Verifiers recompute it (A4). Derived
routes[].nonce 32 random bytes, lowercase hex. Route config
routes[].model_identity, model_identity_id The exact model you serve and its hash. See model identity. Route config, derived
routes[].endpoint Where buyers send POST /v1/chat/completions. Route config
routes[].schedule, schedule_digest Price schedule and SHA256(jcs(schedule)). Every Hold names this digest. See pricing. Route config, derived
routes[].policy {zdr, region}. See policies. Route config
routes[].settler The settler public key. Buyers open channels naming it as seller_settler. settlerKeyFile
routes[].payout_token The token account redemptions pay. payoutToken
routes[].receipt_key, key_epoch The key that signs this route's new receipts. receipt_keys[key_epoch] must equal receipt_key, or indexers drop the listing. receiptKeyFile, keyEpoch

What verifiers check

The discovery indexer and the SDK reject a listing unless all of these hold:

  • the envelope has exactly doc, sig and key; key equals the pinned seller key and doc.seller_id; the signature verifies;
  • at most 128 routes and 128 receipt keys; no receipt-key epoch appears twice; each epoch fits in a u32;
  • every route's IDs, digests and hashes are 64 lowercase hex characters and recompute exactly from the served objects;
  • the schedule has the fixed values v: 1, USDC, micro-USDC, ack_timeout_ms: 5000, failure_billing: "none";
  • the endpoint passes the verifier's origin policy (pinned origin, no redirects, path /v1/chat/completions);
  • no two routes share a route ID.

An indexer re-fetches your listing on every crawl (every 30 s by default) and treats a listing it could not recheck for 900 s as stale.

Changing a listing

The listing is re-signed whenever the gateway starts. What a change does depends on what is hashed:

You change Effect
nonce, endpoint, or anything in modelIdentity New route_id. Old Holds name the old route and get 402 route_mismatch. Add the new route alongside the old one and migrate buyers before removing it.
Anything in schedule New schedule_digest. Holds signed against the old digest get 402 schedule_mismatch. Add a new route for the new prices.
policy Signed but not part of the route ID or digest. Buyers re-read it on refresh.
Listing key New seller_id, so every route ID changes. Treat it as a new seller (operations).

Use the self-check to confirm the served listing matches what you intended.