DIM · Dagon Inference Marketplace

Discovery API and MCP tools

The indexer crawls seller listings and capacity, accepts signed probe observations from allowlisted operators, and serves what it has verified. It never probes sellers while serving.

Signed responses

Every response produced by the indexer, including errors (400, 403, 404, 405, 409, 413, 503), is a signed JSON envelope under the indexer's attestation key (A27, A30). The signed document always carries:

Member Meaning
query REST: the path plus the query string with parameters sorted. MCP: {"tool", "args"} with the exact arguments.
issued_at Unix seconds when it was signed

A client must pin the attestation key in its configuration and reject a response whose signature fails, whose query is not its own request, or whose issued_at is more than 300 seconds from its clock (A15, A27). Responses served from cache are at most 60 seconds old. Seller listings, capacity reports and observations inside a response stay separately signed by their own keys; verify those too.

HEAD answers with the same status as the matching GET and an empty body; its X-IM-Attestation header holds the unpadded base64url encoding of a signed {query, issued_at, status, body_sha256}, where body_sha256 is the hex SHA-256 of the body GET would return (A32).

REST endpoints

Method and path Returns
GET /v1/routes A page of routes. Filters: model_identity_id, family, observation_history=1 (needs family), limit (1–200, default 100), cursor
GET /v1/routes/{route_id} One route with its full signed listing
GET /v1/price-history?family=… Seven days of the lowest observed visible-output rate per quantization; optionally narrowed by seller or route, not both
POST /v1/observations Ingest an operator-signed observation: 201 when new, 200 on an identical replay, 409 on a conflicting window
GET /.well-known/im-indexer.json {"attestation_key"}, informational only; never a trust bootstrap (A15)

Transient failures, including a full signing queue, are a signed 503 service_unavailable with Retry-After: 1. Every signed response stays within 1 MiB (A18), so a page may hold fewer routes than limit.

Route page

{
  "listings": { "<listing_digest>": { "doc": { "…": "signed listing" }, "key": "…", "sig": "…" } },
  "routes": [{
    "listing_digest": "<hex>",
    "route_id": "<hex>",
    "capacity": { "doc": { "…": "signed capacity report" }, "key": "…", "sig": "…" },
    "observations": [{ "doc": { "…": "signed observation" }, "key": "…", "sig": "…" }],
    "score_inputs": { "route_id": "<hex>", "advertised_headroom": 6, "measurement": { "…": "latest observation doc" } }
  }],
  "next_cursor": "<opaque string or null>",
  "query": "/v1/routes?limit=100",
  "issued_at": 1700000000
}
  • Each listing appears once per page in listings, keyed by listing_digest: the lowercase hex SHA-256 of jcs({doc, key, sig}) of the full signed listing (A33a). Verify each listing once, recompute its digest, then find each route inside it.
  • Pages are ordered by (seller_id, route_id); do not assume global route_id order. Reuse a cursor only with the same filters.
  • capacity and advertised_headroom are null when no fresh capacity report exists. observations holds the latest fresh window per pinned operator, or with observation_history=1 the retained windows of the last 24 hours, newest first.

GET /v1/routes/{route_id} returns {listing, capacity, observations, score_inputs} for one route, with the full signed listing in place of a digest, or a signed 404 route_not_found.

Probe observation

An observation is a signed JSON document under the operator's key, and operator must equal the envelope key:

Member Rule
route_id 64 lowercase hex characters
window_start, window_end Unix seconds; a window lasts at most 900 seconds and must end within the freshness TTL
ttft_ms_p50, ttft_ms_p95 milliseconds, p50 ≤ p95
tps_p50 tokens per second, rounded
throughput_curve 1 to 4 points {concurrency, tokens_per_sec, error_rate}, at concurrency 1, 4, 16, 64 in increasing order
availability basis points, 0 to 10,000
samples at least the sum of the curve's concurrency levels
operator base58 operator key

MCP tools

The same data is available over the Model Context Protocol, on POST /mcp (Streamable HTTP; other methods get a signed 405) or over standard I/O. Tool results carry the signed envelope as structured content and as text, and are marked as errors for non-200 statuses.

list_routes

List verified inference routes and seller/operator evidence in an indexer-signed envelope.

Argument Type Required
model_identity_id string, 64 lowercase hex characters no
family string, 1–256 characters no
limit integer, 1–200 no
cursor string, exactly 86 characters (opaque cursor) no

get_route

Read one inference route by its SHA-256 id in an indexer-signed envelope.

Argument Type Required
route_id string, 64 lowercase hex characters yes

Arguments are a strict object: unknown members are rejected.

<sub>Generated from services/discovery/src/mcp.ts, services/discovery/src/cursor.ts.</sub>

MCP responses always carry only the latest observation windows.

Errors

HTTP error.code Message
400 invalid_filter Invalid route filters
400 invalid_observation Invalid observation
400 invalid_request Invalid request
403 forbidden_origin Origin not allowed
404 route_not_found Route not found
404 not_found Endpoint or method not found
405 method_not_allowed Method not allowed
409 observation_conflict Observation conflicts with an accepted window
413 request_too_large Request too large
503 response_too_large Response too large
503 service_unavailable Service unavailable

<sub>Generated from services/discovery/src/api.ts.</sub>