{
  "openapi": "3.1.0",
  "info": {
    "title": "floprouter API",
    "version": "1.0.0",
    "description": "The floprouter API routes chat requests to FLOP Network miners and settles each one on chain. One request format covers every model: chat completions with `provider` preferences and a `models` fallback list, model objects, a generation lookup, one error format and one streaming format. FLOP's own concepts have their own routes: miners, sessions on payment channels, session-key grants, the prepaid FLOP balance, settlement and on-chain attribution. **Base paths**: `/api/v1/...` and `/v1/...` serve the same routes; this document lists them under `/v1`. **Payer modes** (per key, overridable per request with `flop.payer`):\n- `grant`: the caller's wallet is the on-chain payer (channel `agent`) of every session. The wallet signs one `flopSessionKeys.createSession` grant to the router's delegate (`GET /v1/grants/params` returns the exact call data); the router then opens channels within the grant's caps. The escrow is paid on chain from the wallet; only the router fee comes from the prepaid balance. - `credit`: the router's wallet pays the session on chain; escrow and router fee are taken from the prepaid balance. **Balance**: fund it with a plain FLOP transfer from your wallet to `deposit_address` (`GET /v1/balance`); it is credited once the block is finalized. Withdraw with `POST /v1/balance/withdraw` (to the owning wallet only). The router fee is `fee_percent` of the session's escrow, charged only when the channel settles paid. **One request shape for every model**: the router chooses the chat envelope, template version, token limits and parameter support per model from what the chain and the miner's signed info say. Parameters a model does not support (see its `supported_parameters`) are ignored and named in `X-Floprouter-Ignored-Parameters`; `provider.require_parameters` refuses them instead. **Cost** (`usage.cost`, in FLOP): the escrow (prompt plus `max_tokens` at the model's price, paid in full on a cooperative settle) plus the router fee. Final once the session settles; a refunded session costs 0. **Timing**: a proxy in front closes responses idle for 100 s. Non-streaming calls answer within about 85 s: with the verified reply, or with HTTP 202 and the generation id to poll (`GET /v1/generation?id=`). Streams send `: FLOPROUTER PROCESSING` comments at least every 15 s. **Streaming**: chat completion chunks ending in a usage chunk (one choice repeating `finish_reason`) and `data: [DONE]`. Text is forwarded as the miner streams it and is provisional until the turn's signed receipt is verified at the end of the turn. A mid-stream error is one chunk with a top-level `error` and `finish_reason: \"error\"`. **Errors**: `{\"error\": {\"code\": <HTTP status>, \"message\", \"metadata\": {\"reason\", ...}}}`; 429 and 503 carry `Retry-After`. **Miner score**: computed by the router from on-chain facts only (settlement history, volume, stake, slashing record, calibration state). The raw facts are returned beside it. **Client libraries**: the chat endpoint uses the widely used chat completions request and response format, so any client library for that format works with `baseURL` set to `https://api.floprouter.com/api/v1` and a floprouter key.",
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.floprouter.com",
      "description": "API used by this site"
    }
  ],
  "tags": [
    {
      "name": "Inference",
      "description": "Chat completions and sessions."
    },
    {
      "name": "Models",
      "description": "Models, with their prices, limits and supported parameters, and the miners serving each."
    },
    {
      "name": "Auth",
      "description": "Wallet-signed API keys."
    },
    {
      "name": "Grants",
      "description": "Grant payer mode: the wallet stays the on-chain payer."
    },
    {
      "name": "Balance",
      "description": "Prepaid balance and ledger."
    },
    {
      "name": "Directory",
      "description": "No key needed."
    },
    {
      "name": "Service",
      "description": "Health and this document."
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Chat completion, settled on chain",
        "tags": [
          "Inference"
        ],
        "description": "Chooses a miner (or follows `provider`), opens a payment channel with the caller's payer mode, runs one verified turn, and answers with the reply. If an attempt fails before any output, the next miner is tried, then the next model of `models`. Grant mode opens channels with miners' signed offers only: miners with a live offer are tried first, and when none has one the request waits up to 40 s for a fresh offer before moving on. Also served at `/api/v1/chat/completions`.",
        "security": [
          {
            "bearer": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              },
              "examples": {
                "conversation": {
                  "value": {
                    "model": "qwen/qwen3-8b",
                    "max_tokens": 60,
                    "messages": [
                      {
                        "role": "system",
                        "content": "You are a pirate. Answer every question in one short sentence of pirate speech."
                      },
                      {
                        "role": "user",
                        "content": "My name is Ada. What is 2 + 2?"
                      },
                      {
                        "role": "assistant",
                        "content": "Arr, that be 4, matey!"
                      },
                      {
                        "role": "user",
                        "content": "What is my name?"
                      }
                    ]
                  }
                },
                "stream": {
                  "value": {
                    "model": "qwen/qwen3-8b",
                    "stream": true,
                    "max_tokens": 40,
                    "messages": [
                      {
                        "role": "user",
                        "content": "Name a primary colour."
                      }
                    ]
                  }
                },
                "fallback_and_routing": {
                  "value": {
                    "model": "qwen/qwen3-8b",
                    "models": [
                      "qwen/qwen2.5-0.5b-instruct"
                    ],
                    "messages": [
                      {
                        "role": "user",
                        "content": "Who pays for this request?"
                      }
                    ],
                    "max_tokens": 32,
                    "provider": {
                      "sort": "latency",
                      "max_price": {
                        "prompt": 100,
                        "completion": 100
                      },
                      "quantizations": [
                        "bf16"
                      ]
                    },
                    "flop": {
                      "payer": "grant",
                      "fallback_payer": "credit"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified reply. With `stream: true` the body is `text/event-stream`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatResponse"
                },
                "example": {
                  "id": "gen-mwu3v1s3-ab700a21edac",
                  "object": "chat.completion",
                  "created": 1795489132,
                  "model": "qwen/qwen3-8b",
                  "provider": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                  "choices": [
                    {
                      "index": 0,
                      "message": {
                        "role": "assistant",
                        "content": "The user pays for this request.",
                        "refusal": null,
                        "reasoning": null
                      },
                      "finish_reason": "stop",
                      "logprobs": null,
                      "native_finish_reason": "stop"
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 29,
                    "completion_tokens": 8,
                    "total_tokens": 37,
                    "prompt_tokens_details": {
                      "cached_tokens": 0
                    },
                    "completion_tokens_details": {
                      "reasoning_tokens": 0
                    },
                    "cost": 0.0105,
                    "is_byok": false,
                    "cost_details": {
                      "upstream_inference_cost": 0.01,
                      "upstream_inference_prompt_cost": 0.007838,
                      "upstream_inference_completions_cost": 0.002162,
                      "router_fee": 0.0005,
                      "currency": "FLOP",
                      "final": false
                    }
                  },
                  "flop": {
                    "session_id": "gen-mwu3v1s3-ab700a21edac",
                    "status": "settling",
                    "model": "Qwen/Qwen3-8B",
                    "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                    "created_at": "2026-11-24T02:58:37.000Z",
                    "channel_id": "0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                    "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                    "endpoint": "https://miner-002.0xmakase.co.jp",
                    "via": "offer",
                    "payer": {
                      "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                      "kind": "session-key",
                      "mode": "grant",
                      "fallback_from": null,
                      "account": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                      "delegate": "5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7",
                      "note": "The on-chain payer (channel agent) is 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS, through a flopSessionKeys grant to the router's delegate 5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7; the delegate signed the open and paid its transaction fee, the escrow came from 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS."
                    },
                    "escrow": "0.01",
                    "miner_paid": null,
                    "router_fee": {
                      "percent": 5,
                      "amount": "0.0005",
                      "charged": false,
                      "charged_amount": null,
                      "status": "pending",
                      "note": "Charged from the prepaid balance only when the session's channel settles paid."
                    },
                    "wire": "flop.chat-turn.v2",
                    "currency": "FLOP",
                    "network": "devnet",
                    "on_chain": {
                      "open_block": 4493717,
                      "outcome": null,
                      "outcome_block": null,
                      "outcome_tx": null
                    },
                    "usage": {
                      "prompt_tokens": 29,
                      "completion_tokens": 8,
                      "finish_reason": "stop"
                    },
                    "error": null,
                    "attempts": [
                      {
                        "n": 1,
                        "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                        "endpoint": "https://miner-002.0xmakase.co.jp",
                        "via": "offer",
                        "channel_id": "0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                        "escrow": "0.01",
                        "status": "settled",
                        "stage": "settlement",
                        "error": null,
                        "outcome": "settled",
                        "miner_paid": "0.0085",
                        "refunded": null,
                        "open_block": 4493717,
                        "outcome_block": 4493761,
                        "outcome_tx": "0x10e0b1517da1fae6b5dcdeb08cde2efcc33f488a34b9f66bf8bafe438796b57a",
                        "first_output_ms": 14748,
                        "recovery": []
                      }
                    ],
                    "links": {
                      "channel": "https://explorer.devnet.flop.network/api/compute-channels/0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                      "session": "/v1/sessions/gen-mwu3v1s3-ab700a21edac"
                    },
                    "ignored_parameters": [
                      "temperature"
                    ]
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": ": FLOPROUTER PROCESSING\n\ndata: {\"id\":\"gen-mwu43k8o-4c620dd46c46\",\"object\":\"chat.completion.chunk\",\"created\":1795489493,\"model\":\"qwen/qwen3-8b\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"finish_reason\":null,\"native_finish_reason\":null,\"logprobs\":null}]}\n\n: FLOPROUTER PROCESSING\n\ndata: {\"id\":\"gen-mwu43k8o-4c620dd46c46\",\"object\":\"chat.completion.chunk\",\"created\":1795489493,\"model\":\"qwen/qwen3-8b\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Red.\"},\"finish_reason\":null,\"native_finish_reason\":null,\"logprobs\":null}]}\n\ndata: {\"id\":\"gen-mwu43k8o-4c620dd46c46\",\"object\":\"chat.completion.chunk\",\"created\":1795489493,\"model\":\"qwen/qwen3-8b\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"\"},\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"logprobs\":null}],\"provider\":\"5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92\"}\n\ndata: {\"id\":\"gen-mwu43k8o-4c620dd46c46\",\"object\":\"chat.completion.chunk\",\"created\":1795489493,\"model\":\"qwen/qwen3-8b\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"\",\"role\":\"assistant\"},\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"logprobs\":null}],\"provider\":\"5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92\",\"usage\":{\"prompt_tokens\":28,\"completion_tokens\":3,\"total_tokens\":31,\"cost\":0.0105},\"flop\":{\"session_id\":\"gen-mwu43k8o-4c620dd46c46\",\"status\":\"settling\"}}\n\ndata: [DONE]\n\n"
              }
            },
            "headers": {
              "X-Generation-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "X-Floprouter-Ignored-Parameters": {
                "schema": {
                  "type": "string"
                },
                "description": "Comma-separated parameters this model ignored."
              }
            }
          },
          "202": {
            "description": "No verified reply within the response deadline; poll the session.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatPending"
                },
                "example": {
                  "id": "gen-mwu3v1s3-ab700a21edac",
                  "object": "chat.completion.pending",
                  "created": 1795489132,
                  "model": "qwen/qwen3-8b",
                  "status": "pending",
                  "message": "no verified reply within 85 s; the generation continues. Poll GET /api/v1/generation?id=gen-mwu3v1s3-ab700a21edac (or GET /api/v1/sessions/gen-mwu3v1s3-ab700a21edac) until it has a reply, or use stream: true.",
                  "poll": "/v1/sessions/gen-mwu3v1s3-ab700a21edac",
                  "flop": null,
                  "generation": "/api/v1/generation?id=gen-mwu3v1s3-ab700a21edac"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        }
      }
    },
    "/v1/generation": {
      "get": {
        "operationId": "getGeneration",
        "summary": "Generation stats for a session",
        "tags": [
          "Inference"
        ],
        "security": [
          {
            "bearer": []
          },
          {}
        ],
        "description": "Tokens, cost in FLOP, finish reasons, latency, app headers, the verified reply, and the session (settlement record) under `flop`. A wallet's generations need that wallet's key.",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^gen-[0-9A-Za-z-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "gen-mwu6ngd2-6002b42b549f",
                    "model": "qwen/qwen3-8b",
                    "created_at": "2026-11-24T04:16:42.000Z",
                    "api_type": "completions",
                    "streamed": false,
                    "cancelled": false,
                    "provider_name": "miner-002.0xmakase.co.jp",
                    "finish_reason": "stop",
                    "native_finish_reason": "stop",
                    "tokens_prompt": 29,
                    "tokens_completion": 8,
                    "native_tokens_prompt": 29,
                    "native_tokens_completion": 8,
                    "native_tokens_reasoning": null,
                    "native_tokens_cached": 0,
                    "total_cost": 0.0105,
                    "usage": 0.0105,
                    "upstream_inference_cost": 0.01,
                    "is_byok": false,
                    "latency": 14887,
                    "generation_time": 3964,
                    "http_referer": null,
                    "app_title": null,
                    "user_agent": null,
                    "flop": {
                      "session_id": "gen-mwu6ngd2-6002b42b549f",
                      "status": "settled",
                      "channel_id": "0xd05040e5b483ae6afe96a8027d4e8fadb431cdb954f24f9342475610c92ec4be",
                      "currency": "FLOP",
                      "cost_final": true
                    },
                    "reply": {
                      "role": "assistant",
                      "content": "The user pays for this request."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 400,
                    "message": "id must be a generation id (gen-...)",
                    "metadata": {
                      "reason": "invalid_id"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "description": "Unknown, or another wallet's",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 404,
                    "message": "no such generation",
                    "metadata": {
                      "reason": "generation_not_found"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions": {
      "get": {
        "operationId": "listSessions",
        "summary": "The calling wallet's sessions, newest first",
        "tags": [
          "Inference"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionList"
                },
                "example": {
                  "object": "list",
                  "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                  "total": 2,
                  "limit": 1,
                  "offset": 0,
                  "data": [
                    {
                      "session_id": "gen-mwu3v1s3-ab700a21edac",
                      "status": "settled",
                      "model": "Qwen/Qwen3-8B",
                      "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                      "created_at": "2026-11-24T02:58:37.000Z",
                      "channel_id": "0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                      "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                      "endpoint": "https://miner-002.0xmakase.co.jp",
                      "via": "offer",
                      "payer": {
                        "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                        "kind": "session-key",
                        "mode": "grant",
                        "fallback_from": null,
                        "account": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                        "delegate": "5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7",
                        "note": "The on-chain payer (channel agent) is 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS, through a flopSessionKeys grant to the router's delegate 5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7; the delegate signed the open and paid its transaction fee, the escrow came from 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS."
                      },
                      "escrow": "0.01",
                      "miner_paid": "0.0085",
                      "router_fee": {
                        "percent": 5,
                        "amount": "0.0005",
                        "charged": true,
                        "charged_amount": "0.0005",
                        "status": "charged",
                        "note": "Charged from the prepaid balance only when the session's channel settles paid."
                      },
                      "wire": "flop.chat-turn.v2",
                      "currency": "FLOP",
                      "network": "devnet",
                      "on_chain": {
                        "open_block": 4493717,
                        "outcome": "settled",
                        "outcome_block": 4493761,
                        "outcome_tx": "0x10e0b1517da1fae6b5dcdeb08cde2efcc33f488a34b9f66bf8bafe438796b57a"
                      },
                      "usage": {
                        "prompt_tokens": 29,
                        "completion_tokens": 8,
                        "finish_reason": "stop"
                      },
                      "error": null,
                      "links": {
                        "channel": "https://explorer.devnet.flop.network/api/compute-channels/0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                        "session": "/v1/sessions/gen-mwu3v1s3-ab700a21edac"
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/v1/sessions/{id}": {
      "get": {
        "operationId": "getSession",
        "summary": "A session's status, cost and on-chain record",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The `id` of a chat completion."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                },
                "example": {
                  "session_id": "gen-mwu3v1s3-ab700a21edac",
                  "status": "settled",
                  "model": "Qwen/Qwen3-8B",
                  "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                  "created_at": "2026-11-24T02:58:37.000Z",
                  "channel_id": "0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                  "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                  "endpoint": "https://miner-002.0xmakase.co.jp",
                  "via": "offer",
                  "payer": {
                    "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                    "kind": "session-key",
                    "mode": "grant",
                    "fallback_from": null,
                    "account": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                    "delegate": "5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7",
                    "note": "The on-chain payer (channel agent) is 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS, through a flopSessionKeys grant to the router's delegate 5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7; the delegate signed the open and paid its transaction fee, the escrow came from 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS."
                  },
                  "escrow": "0.01",
                  "miner_paid": "0.0085",
                  "router_fee": {
                    "percent": 5,
                    "amount": "0.0005",
                    "charged": true,
                    "charged_amount": "0.0005",
                    "status": "charged",
                    "note": "Charged from the prepaid balance only when the session's channel settles paid."
                  },
                  "wire": "flop.chat-turn.v2",
                  "currency": "FLOP",
                  "network": "devnet",
                  "on_chain": {
                    "open_block": 4493717,
                    "outcome": "settled",
                    "outcome_block": 4493761,
                    "outcome_tx": "0x10e0b1517da1fae6b5dcdeb08cde2efcc33f488a34b9f66bf8bafe438796b57a"
                  },
                  "usage": {
                    "prompt_tokens": 29,
                    "completion_tokens": 8,
                    "finish_reason": "stop"
                  },
                  "error": null,
                  "attempts": [
                    {
                      "n": 1,
                      "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                      "endpoint": "https://miner-002.0xmakase.co.jp",
                      "via": "offer",
                      "channel_id": "0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                      "escrow": "0.01",
                      "status": "settled",
                      "stage": "settlement",
                      "error": null,
                      "outcome": "settled",
                      "miner_paid": "0.0085",
                      "refunded": null,
                      "open_block": 4493717,
                      "outcome_block": 4493761,
                      "outcome_tx": "0x10e0b1517da1fae6b5dcdeb08cde2efcc33f488a34b9f66bf8bafe438796b57a",
                      "first_output_ms": 14748,
                      "recovery": []
                    }
                  ],
                  "links": {
                    "channel": "https://explorer.devnet.flop.network/api/compute-channels/0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                    "session": "/v1/sessions/gen-mwu3v1s3-ab700a21edac"
                  },
                  "reply": {
                    "role": "assistant",
                    "content": "The user pays for this request.",
                    "finish_reason": "stop"
                  },
                  "reply_visible": true
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        },
        "tags": [
          "Inference"
        ],
        "description": "Settlement state of one session: channel, miner, payer, escrow, router fee, on-chain blocks and transaction, every attempt. Readable by anyone holding the id (an unguessable value); the reply text is included only for the wallet that owns the session.",
        "security": [
          {
            "bearer": []
          },
          {}
        ]
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "Models",
        "tags": [
          "Models"
        ],
        "security": [],
        "parameters": [
          {
            "name": "supported_parameters",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated; only models supporting all of them."
          },
          {
            "name": "output_modalities",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "text (or all)."
          },
          {
            "name": "available",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "true: only models a ready miner serves now."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": ""
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "max 1000"
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Accepted and ignored."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "nousresearch/arete-27b",
                      "canonical_slug": "nousresearch/arete-27b",
                      "hugging_face_id": "NousResearch/Arete-27B",
                      "name": "NousResearch/Arete-27B",
                      "created": 0,
                      "description": "NousResearch/Arete-27B, served by FLOP Network miners. Every reply is checked against the miner's signed receipt before it is returned.",
                      "context_length": 10000,
                      "architecture": {
                        "modality": "text->text",
                        "input_modalities": [
                          "text"
                        ],
                        "output_modalities": [
                          "text"
                        ],
                        "tokenizer": "Arete",
                        "instruct_type": null
                      },
                      "pricing": {
                        "prompt": "0.00005",
                        "completion": "0.00005",
                        "request": "0",
                        "image": "0",
                        "web_search": "0",
                        "internal_reasoning": "0"
                      },
                      "top_provider": {
                        "context_length": 10000,
                        "max_completion_tokens": 8192,
                        "is_moderated": false
                      },
                      "per_request_limits": null,
                      "supported_parameters": [
                        "max_tokens"
                      ],
                      "default_parameters": null,
                      "knowledge_cutoff": null,
                      "expiration_date": null,
                      "endpoints": [
                        "/api/v1/chat/completions"
                      ],
                      "links": {
                        "details": "/api/v1/models/nousresearch/arete-27b/endpoints"
                      },
                      "flop": {
                        "model_hash": "0xd1fa9165a2f43b9a87a53b1acad8dfa9b593ebd532a461e095d3a1a440db8598",
                        "registry_version": "1",
                        "params_billion": 27,
                        "precisions": [
                          "BF16"
                        ],
                        "gflops_per_token": 52,
                        "providers_reachable": 0,
                        "providers_ready": 0,
                        "available": false,
                        "currency": "FLOP",
                        "pricing_unit": "FLOP per token",
                        "min_charge_per_request": "0.01",
                        "escrow_per_1000_tokens": null,
                        "router_fee_percent": 5,
                        "chat_wire": "flop.chat-turn.v2",
                        "pricing_note": "A request escrows prompt plus max_tokens at this price (at least min_charge_per_request); a cooperative settle pays the whole escrow, so the cost follows max_tokens, not the tokens actually produced."
                      }
                    },
                    {
                      "id": "qwen/qwen2.5-0.5b-instruct",
                      "canonical_slug": "qwen/qwen2.5-0.5b-instruct",
                      "hugging_face_id": "Qwen/Qwen2.5-0.5B-Instruct",
                      "name": "Qwen/Qwen2.5-0.5B-Instruct",
                      "created": 0,
                      "description": "Qwen/Qwen2.5-0.5B-Instruct, served by FLOP Network miners. Every reply is checked against the miner's signed receipt before it is returned.",
                      "context_length": 10000,
                      "architecture": {
                        "modality": "text->text",
                        "input_modalities": [
                          "text"
                        ],
                        "output_modalities": [
                          "text"
                        ],
                        "tokenizer": "Qwen",
                        "instruct_type": null
                      },
                      "pricing": {
                        "prompt": "0.00005",
                        "completion": "0.00005",
                        "request": "0",
                        "image": "0",
                        "web_search": "0",
                        "internal_reasoning": "0"
                      },
                      "top_provider": {
                        "context_length": 10000,
                        "max_completion_tokens": 8192,
                        "is_moderated": false
                      },
                      "per_request_limits": null,
                      "supported_parameters": [
                        "max_tokens"
                      ],
                      "default_parameters": null,
                      "knowledge_cutoff": null,
                      "expiration_date": null,
                      "endpoints": [
                        "/api/v1/chat/completions"
                      ],
                      "links": {
                        "details": "/api/v1/models/qwen/qwen2.5-0.5b-instruct/endpoints"
                      },
                      "flop": {
                        "model_hash": "0x1a52c1abe781db051e70ae357f72bb70161ca0c092df0b618f22a9292ba63306",
                        "registry_version": "1",
                        "params_billion": 1,
                        "precisions": [
                          "BF16"
                        ],
                        "gflops_per_token": 2,
                        "providers_reachable": 0,
                        "providers_ready": 0,
                        "available": false,
                        "currency": "FLOP",
                        "pricing_unit": "FLOP per token",
                        "min_charge_per_request": "0.01",
                        "escrow_per_1000_tokens": null,
                        "router_fee_percent": 5,
                        "chat_wire": "flop.chat-turn.v2",
                        "pricing_note": "A request escrows prompt plus max_tokens at this price (at least min_charge_per_request); a cooperative settle pays the whole escrow, so the cost follows max_tokens, not the tokens actually produced."
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/count": {
      "get": {
        "operationId": "countModels",
        "summary": "Number of models",
        "tags": [
          "Models"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "count": 6
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/{author}/{slug}": {
      "get": {
        "operationId": "getModel",
        "summary": "One model by its id",
        "tags": [
          "Models"
        ],
        "security": [],
        "parameters": [
          {
            "name": "author",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "qwen"
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "qwen3-8b"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Model"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "qwen/qwen3-8b",
                    "canonical_slug": "qwen/qwen3-8b",
                    "hugging_face_id": "Qwen/Qwen3-8B",
                    "name": "Qwen/Qwen3-8B",
                    "created": 0,
                    "description": "Qwen/Qwen3-8B, served by FLOP Network miners. Every reply is checked against the miner's signed receipt before it is returned.",
                    "context_length": 10000,
                    "architecture": {
                      "modality": "text->text",
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "tokenizer": "Qwen",
                      "instruct_type": null
                    },
                    "pricing": {
                      "prompt": "0.00005",
                      "completion": "0.00005",
                      "request": "0",
                      "image": "0",
                      "web_search": "0",
                      "internal_reasoning": "0"
                    },
                    "top_provider": {
                      "context_length": 10000,
                      "max_completion_tokens": 8192,
                      "is_moderated": false
                    },
                    "per_request_limits": null,
                    "supported_parameters": [
                      "max_tokens"
                    ],
                    "default_parameters": null,
                    "knowledge_cutoff": null,
                    "expiration_date": null,
                    "endpoints": [
                      "/api/v1/chat/completions"
                    ],
                    "links": {
                      "details": "/api/v1/models/qwen/qwen3-8b/endpoints"
                    },
                    "flop": {
                      "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                      "registry_version": "1",
                      "params_billion": 8,
                      "precisions": [
                        "BF16"
                      ],
                      "gflops_per_token": 17,
                      "providers_reachable": 0,
                      "providers_ready": 0,
                      "available": false,
                      "currency": "FLOP",
                      "pricing_unit": "FLOP per token",
                      "min_charge_per_request": "0.01",
                      "escrow_per_1000_tokens": "0.05",
                      "router_fee_percent": 5,
                      "chat_wire": "flop.chat-turn.v2",
                      "pricing_note": "A request escrows prompt plus max_tokens at this price (at least min_charge_per_request); a cooperative settle pays the whole escrow, so the cost follows max_tokens, not the tokens actually produced."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not a verified model",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 404,
                    "message": "model \"nobody/none\" is not a verified model on this network",
                    "metadata": {
                      "reason": "model_not_found"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/model/{author}/{slug}": {
      "get": {
        "operationId": "getModelSingular",
        "summary": "One model by its id (singular path)",
        "tags": [
          "Models"
        ],
        "security": [],
        "parameters": [
          {
            "name": "author",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "qwen"
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "qwen3-8b"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Model"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "qwen/qwen3-8b",
                    "canonical_slug": "qwen/qwen3-8b",
                    "hugging_face_id": "Qwen/Qwen3-8B",
                    "name": "Qwen/Qwen3-8B",
                    "created": 0,
                    "description": "Qwen/Qwen3-8B, served by FLOP Network miners. Every reply is checked against the miner's signed receipt before it is returned.",
                    "context_length": 10000,
                    "architecture": {
                      "modality": "text->text",
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "tokenizer": "Qwen",
                      "instruct_type": null
                    },
                    "pricing": {
                      "prompt": "0.00005",
                      "completion": "0.00005",
                      "request": "0",
                      "image": "0",
                      "web_search": "0",
                      "internal_reasoning": "0"
                    },
                    "top_provider": {
                      "context_length": 10000,
                      "max_completion_tokens": 8192,
                      "is_moderated": false
                    },
                    "per_request_limits": null,
                    "supported_parameters": [
                      "max_tokens"
                    ],
                    "default_parameters": null,
                    "knowledge_cutoff": null,
                    "expiration_date": null,
                    "endpoints": [
                      "/api/v1/chat/completions"
                    ],
                    "links": {
                      "details": "/api/v1/models/qwen/qwen3-8b/endpoints"
                    },
                    "flop": {
                      "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                      "registry_version": "1",
                      "params_billion": 8,
                      "precisions": [
                        "BF16"
                      ],
                      "gflops_per_token": 17,
                      "providers_reachable": 0,
                      "providers_ready": 0,
                      "available": false,
                      "currency": "FLOP",
                      "pricing_unit": "FLOP per token",
                      "min_charge_per_request": "0.01",
                      "escrow_per_1000_tokens": "0.05",
                      "router_fee_percent": 5,
                      "chat_wire": "flop.chat-turn.v2",
                      "pricing_note": "A request escrows prompt plus max_tokens at this price (at least min_charge_per_request); a cooperative settle pays the whole escrow, so the cost follows max_tokens, not the tokens actually produced."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not a verified model",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 404,
                    "message": "model \"nobody/none\" is not a verified model on this network",
                    "metadata": {
                      "reason": "model_not_found"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/{author}/{slug}/endpoints": {
      "get": {
        "operationId": "listModelEndpoints",
        "summary": "Miners serving a model (its endpoints)",
        "tags": [
          "Models"
        ],
        "security": [],
        "parameters": [
          {
            "name": "author",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "qwen"
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "qwen3-8b"
          }
        ],
        "description": "One endpoint per miner that proved it serves the model. status: 0 live and ready, -1 reachable not ready, -2 not answering. uptime_last_1d: share of signed-proof probes that succeeded; latency_last_30m.p50: mean seconds to the verified reply (both all time). The miner details are under `flop`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "endpoints": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "qwen/qwen3-8b",
                    "name": "Qwen/Qwen3-8B",
                    "created": 0,
                    "description": "Qwen/Qwen3-8B, served by FLOP Network miners. Every reply is checked against the miner's signed receipt before it is returned.",
                    "architecture": {
                      "modality": "text->text",
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "tokenizer": "Qwen",
                      "instruct_type": null
                    },
                    "endpoints": [
                      {
                        "name": "miner-002.0xmakase.co.jp | Qwen/Qwen3-8B",
                        "model_id": "qwen/qwen3-8b",
                        "model_name": "Qwen/Qwen3-8B",
                        "context_length": 10000,
                        "pricing": {
                          "prompt": "0.00005",
                          "completion": "0.00005",
                          "request": "0",
                          "image": "0",
                          "web_search": "0",
                          "internal_reasoning": "0"
                        },
                        "provider_name": "miner-002.0xmakase.co.jp",
                        "tag": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                        "quantization": "bf16",
                        "max_completion_tokens": 8192,
                        "max_prompt_tokens": 10000,
                        "supported_parameters": [
                          "max_tokens"
                        ],
                        "status": -2,
                        "uptime_last_5m": null,
                        "uptime_last_30m": null,
                        "uptime_last_1d": 98.6,
                        "latency_last_30m": {
                          "p50": 38.328
                        },
                        "throughput_last_30m": null,
                        "supports_implicit_caching": false,
                        "flop": {
                          "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                          "endpoint": "https://miner-002.0xmakase.co.jp",
                          "score": 67.5,
                          "ready": true,
                          "liveness": "down",
                          "binding": "offer",
                          "worker_image": "0.1.418",
                          "live_signed_offer": true,
                          "sessions_attempted": 44,
                          "sessions_with_output": 24,
                          "uptime_note": "uptime_last_1d is the share of signed-proof probes that succeeded (all time); latency_last_30m.p50 is the mean time to the verified reply in seconds (all time)."
                        }
                      },
                      {
                        "name": "miner-01.technocore-lab.com | Qwen/Qwen3-8B",
                        "model_id": "qwen/qwen3-8b",
                        "model_name": "Qwen/Qwen3-8B",
                        "context_length": 10000,
                        "pricing": {
                          "prompt": "0.00005",
                          "completion": "0.00005",
                          "request": "0",
                          "image": "0",
                          "web_search": "0",
                          "internal_reasoning": "0"
                        },
                        "provider_name": "miner-01.technocore-lab.com",
                        "tag": "5FP2avtDrL4DxdofTFAvGbENJcb4GSi8mcN5Cyc7yHmWFf16",
                        "quantization": null,
                        "max_completion_tokens": 8192,
                        "max_prompt_tokens": 10000,
                        "supported_parameters": [
                          "max_tokens"
                        ],
                        "status": -2,
                        "uptime_last_5m": null,
                        "uptime_last_30m": null,
                        "uptime_last_1d": 100,
                        "latency_last_30m": null,
                        "throughput_last_30m": null,
                        "supports_implicit_caching": false,
                        "flop": {
                          "miner": "5FP2avtDrL4DxdofTFAvGbENJcb4GSi8mcN5Cyc7yHmWFf16",
                          "endpoint": "https://miner-01.technocore-lab.com",
                          "score": 31.2,
                          "ready": true,
                          "liveness": "down",
                          "binding": null,
                          "worker_image": "0.1.418",
                          "live_signed_offer": false,
                          "sessions_attempted": 0,
                          "sessions_with_output": 0,
                          "uptime_note": "uptime_last_1d is the share of signed-proof probes that succeeded (all time); latency_last_30m.p50 is the mean time to the verified reply in seconds (all time)."
                        }
                      }
                    ]
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not a verified model",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 404,
                    "message": "model \"nobody/none\" is not a verified model on this network",
                    "metadata": {
                      "reason": "model_not_found"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/miners": {
      "get": {
        "operationId": "listMiners",
        "summary": "Every registered miner with score, facts, models and endpoint status",
        "parameters": [
          {
            "name": "reachable",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "`true` returns the verified-pairs listing (live, proven miner and endpoint pairs; same content as the published artefact). Add `view=full` for full miner objects instead."
          },
          {
            "name": "view",
            "in": "query",
            "schema": {
              "enum": [
                "full"
              ]
            }
          },
          {
            "name": "ready",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Endpoint reports ready to serve."
          },
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "calibrated",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Hardware calibration lease is live."
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Model id or hash."
          },
          {
            "name": "min_score",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "enum": [
                "score",
                "reliability",
                "settle_rate",
                "sessions",
                "stake",
                "latency",
                "capacity"
              ],
              "default": "score"
            }
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Miners",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/MinerList"
                    },
                    {
                      "$ref": "#/components/schemas/VerifiedPairs"
                    }
                  ]
                },
                "examples": {
                  "registry": {
                    "value": {
                      "object": "list",
                      "network": "devnet",
                      "finalized_block": 4494396,
                      "total": 762,
                      "limit": 1,
                      "offset": 0,
                      "data": [
                        {
                          "address": "5D7fTgzoUwc7L9tHt7GSBtE9GNYuP1x8xfMmFQFVwLXp85Tp",
                          "score": 78.3,
                          "rank": 1,
                          "registered": true,
                          "active": true,
                          "retired": false,
                          "blacklisted": false,
                          "stake": {
                            "self": "12504.899999999883968",
                            "delegated": "0",
                            "sponsored": "0",
                            "total": "12504.899999999883968"
                          },
                          "calibration": {
                            "live": true,
                            "cap_gflops_per_sec": 34396,
                            "version": 3,
                            "tier": "Soft",
                            "accepted_at_block": 4326702,
                            "expires_at_block": 4931502
                          },
                          "capacity": {
                            "cap_gflops_per_sec": 34396,
                            "busy_channels": 13
                          },
                          "slashing": {
                            "strikes": 0,
                            "total_slashed": "0",
                            "failed_acks": 0,
                            "failed_offer_opens": 0
                          },
                          "history": {
                            "sessions_resolved": 69,
                            "settled": 61,
                            "timed_out": 8,
                            "ack_expired": 0,
                            "refunded": 0,
                            "voided": 0,
                            "fraud": 0,
                            "settle_rate": 0.8841,
                            "distinct_payers": 3,
                            "settled_volume": "4.475537138094146403",
                            "last_settled_block": 4456556,
                            "last_opened_block": 4456556,
                            "outcome_basis": {
                              "chain_events": 69,
                              "explorer_indexer": 0,
                              "chain_storage": 0
                            },
                            "unclassified": 0
                          },
                          "models": [
                            {
                              "hash": "0x272ed49f5488f15629805df7821140b3b1ad3917d6ccb008add3c65d0095dea9",
                              "name": "Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8",
                              "id": "qwen/qwen3-coder-30b-a3b-instruct-fp8",
                              "evidence": [
                                "signed-offer"
                              ],
                              "channels": 82,
                              "settled": 61
                            }
                          ],
                          "live_offers": 2,
                          "endpoint": null,
                          "router_measured": {
                            "reachable": false,
                            "ready": false,
                            "probe_success_rate": null,
                            "proof_latency_ms": null,
                            "sessions_attempted": 0,
                            "sessions_with_output": 0,
                            "sessions_settled": 0,
                            "session_success_rate": null,
                            "first_output_ms": null
                          },
                          "links": {
                            "account": "https://explorer.devnet.flop.network/api/miners/5D7fTgzoUwc7L9tHt7GSBtE9GNYuP1x8xfMmFQFVwLXp85Tp"
                          }
                        }
                      ],
                      "score_note": "score (0-100) and rank are computed by the router from on-chain facts only: settlement history, volume, stake, slashing record and calibration state. The raw facts are returned beside it. Router-measured facts (reachability, latency, our own success rate) are reported separately under router_measured."
                    }
                  },
                  "reachable": {
                    "summary": "reachable=true (verified pairs)",
                    "value": {
                      "object": "list",
                      "generated_at": "2026-11-24T03:10:11.634Z",
                      "network": "devnet",
                      "genesis_hash": "0x99c172c095340ace980631f9123544c6bebd4839f3437e463533422d8be2d631",
                      "rpc": [
                        "wss://rpc.devnet.flop.network"
                      ],
                      "indexer": "https://explorer.devnet.flop.network",
                      "finalized_block": 4494396,
                      "rule": "A pair is listed only if the worker at the endpoint returned a fresh signed /session/info-proof naming this chain and a miner account that exists in the on-chain registry. status=live also requires the session key to be tied to that account on chain and a successful probe within the freshness window; unverified means the proof is valid but the key is not yet tied on chain; down means a previously proven pair is failing now.",
                      "liveness_fresh_seconds": 900,
                      "counts": {
                        "candidate_urls": 125,
                        "pairs": 13,
                        "live": 7,
                        "live_and_ready": 1,
                        "unverified": 4,
                        "down": 2
                      },
                      "total": 1,
                      "data": [
                        {
                          "address": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                          "endpoint": "https://miner-002.0xmakase.co.jp",
                          "models": [
                            "Qwen/Qwen3-8B"
                          ],
                          "serving_now": "qwen/qwen3-8b",
                          "ready": true,
                          "reliability": 0.8919,
                          "reliability_detail": {
                            "settled": 132,
                            "resolved": 148,
                            "timed_out": 15,
                            "distinct_payers": 20,
                            "outcome_basis": {
                              "chain_events": 148,
                              "explorer_indexer": 0,
                              "chain_storage": 0
                            },
                            "unclassified": 0
                          },
                          "status": "live",
                          "source": "seed-issues-2026-11-23",
                          "sources": [
                            {
                              "source": "seed-issues-2026-11-23",
                              "first_seen": "2026-11-23T19:06:40.000Z",
                              "hinted_miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                              "verdict": "confirmed by proof"
                            }
                          ],
                          "proof": {
                            "binding": "offer",
                            "session_key": "0x0081319ab4bea9d04d6aa502d9ee203499b38dd3b7ec35731639273b8220ad06",
                            "last_verified": "2026-11-24T03:05:14.000Z",
                            "last_checked": "2026-11-24T03:05:14.000Z",
                            "info_status": 401
                          },
                          "registry": {
                            "registered": true,
                            "active": true,
                            "retired": false
                          },
                          "score": 66.8
                        }
                      ],
                      "score_note": "score (0-100) and rank are computed by the router from on-chain facts only: settlement history, volume, stake, slashing record and calibration state. The raw facts are returned beside it. Router-measured facts (reachability, latency, our own success rate) are reported separately under router_measured."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 400,
                    "message": "sort must be one of score, reliability, settle_rate, sessions, stake, latency, capacity",
                    "metadata": {
                      "reason": "invalid_sort"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Directory"
        ],
        "security": []
      }
    },
    "/v1/miners/{address}": {
      "get": {
        "operationId": "getMiner",
        "summary": "One miner in detail",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Miner account (SS58)."
          }
        ],
        "responses": {
          "200": {
            "description": "Miner",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Miner"
                },
                "example": {
                  "address": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                  "score": 66.8,
                  "rank": 3,
                  "registered": true,
                  "active": true,
                  "retired": false,
                  "blacklisted": false,
                  "stake": {
                    "self": "10000",
                    "delegated": "1000004.1",
                    "sponsored": "1000003",
                    "total": "2010007.1"
                  },
                  "calibration": {
                    "live": true,
                    "cap_gflops_per_sec": 495922,
                    "version": 6,
                    "tier": "Soft",
                    "accepted_at_block": 4407477,
                    "expires_at_block": 5012277
                  },
                  "capacity": {
                    "cap_gflops_per_sec": 495922,
                    "busy_channels": 18
                  },
                  "slashing": {
                    "strikes": 0,
                    "total_slashed": "0",
                    "failed_acks": 0,
                    "failed_offer_opens": 2
                  },
                  "history": {
                    "sessions_resolved": 148,
                    "settled": 132,
                    "timed_out": 15,
                    "ack_expired": 0,
                    "refunded": 0,
                    "voided": 0,
                    "fraud": 1,
                    "settle_rate": 0.8919,
                    "distinct_payers": 20,
                    "settled_volume": "570.164790000175414502",
                    "last_settled_block": 4494127,
                    "last_opened_block": 4494127,
                    "outcome_basis": {
                      "chain_events": 148,
                      "explorer_indexer": 0,
                      "chain_storage": 0
                    },
                    "unclassified": 0
                  },
                  "models": [
                    {
                      "hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                      "name": "Qwen/Qwen3-8B",
                      "id": "qwen/qwen3-8b",
                      "evidence": [
                        "signed-info-proof",
                        "signed-offer"
                      ],
                      "channels": 62,
                      "settled": 51
                    },
                    {
                      "hash": "0x1a52c1abe781db051e70ae357f72bb70161ca0c092df0b618f22a9292ba63306",
                      "name": "Qwen/Qwen2.5-0.5B-Instruct",
                      "id": "qwen/qwen2.5-0.5b-instruct",
                      "evidence": [
                        "channel-history"
                      ],
                      "channels": 103,
                      "settled": 81
                    }
                  ],
                  "live_offers": 2,
                  "endpoint": {
                    "url": "https://miner-002.0xmakase.co.jp",
                    "status": "live",
                    "ready": true,
                    "last_verified": "2026-11-24T03:05:14.000Z",
                    "source": "seed-issues-2026-11-23"
                  },
                  "router_measured": {
                    "reachable": true,
                    "ready": true,
                    "probe_success_rate": 0.984,
                    "proof_latency_ms": 776,
                    "sessions_attempted": 40,
                    "sessions_with_output": 20,
                    "sessions_settled": 18,
                    "session_success_rate": 0.5,
                    "first_output_ms": 33396
                  },
                  "links": {
                    "account": "https://explorer.devnet.flop.network/api/miners/5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92"
                  },
                  "endpoints": [
                    {
                      "url": "https://miner-002.0xmakase.co.jp",
                      "status": "live",
                      "ready": true,
                      "binding": "offer",
                      "model": "qwen/qwen3-8b",
                      "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                      "source": "seed-issues-2026-11-23",
                      "sources": [
                        {
                          "source": "seed-issues-2026-11-23",
                          "first_seen": "2026-11-23T19:06:40.000Z"
                        },
                        {
                          "source": "submission",
                          "first_seen": "2026-11-23T19:42:47.000Z"
                        }
                      ],
                      "first_seen": "2026-11-23T19:06:58.000Z",
                      "last_verified": "2026-11-24T03:05:14.000Z",
                      "last_checked": "2026-11-24T03:05:14.000Z",
                      "proof_latency_ms": 776,
                      "probe_success_rate": 0.984,
                      "worker_image": "0.1.418",
                      "last_error": null
                    }
                  ],
                  "registered_at_block": 1468857,
                  "commission": 0.1,
                  "calibration_canaries": {
                    "issued": 10127,
                    "completed": 10118,
                    "expired": 9,
                    "incorrect": 0
                  },
                  "updated_at_block": 4494065,
                  "scored_at_block": 4494378,
                  "recent_channels": [
                    {
                      "id": "0xcfa6c2a77dd2161509456d82bb907817b046915fd7473d9b0e3bcc4ad4601b75",
                      "payer": "5GmdxzsmKFi31y1qXYJfxmeBvDoUhxR6D4DnVxbAUjQ8RNnw",
                      "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                      "escrow": "0.01",
                      "opened_block": 4494127,
                      "outcome": "settled",
                      "outcome_block": 4494294,
                      "miner_paid": "0.0085",
                      "model": "Qwen/Qwen3-8B"
                    },
                    {
                      "id": "0xcddfd0102e2155f8e604bf7b0ad1c22a204112b2be7de6a0f374faa5c3f42e33",
                      "payer": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                      "model_hash": "0xfab8ec57f3bc1b5d4ca644fe12fab2ca1c35c24697d577c610b382cfea14d52d",
                      "escrow": "0.01",
                      "opened_block": 4493712,
                      "outcome": "settled",
                      "outcome_block": 4493761,
                      "miner_paid": "0.0085",
                      "model": "Qwen/Qwen3-8B"
                    }
                  ],
                  "score_note": "score (0-100) and rank are computed by the router from on-chain facts only: settlement history, volume, stake, slashing record and calibration state. The raw facts are returned beside it. Router-measured facts (reachability, latency, our own success rate) are reported separately under router_measured."
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 404,
                    "message": "no such miner in the on-chain registry",
                    "metadata": {
                      "reason": "miner_not_found"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Directory"
        ],
        "security": []
      }
    },
    "/v1/miners/{address}/endpoint": {
      "post": {
        "operationId": "submitMinerEndpoint",
        "summary": "Submit a session URL for a miner",
        "description": "Anyone may submit. The URL is accepted only if the worker behind it answers a fresh challenge with a signed `/session/info-proof` that names this miner account and this chain, and the signing session key is tied to the miner account on chain (a miner-signed offer or a past channel). Accepted entries are re-verified on a schedule and dropped when they stop answering.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "`https://host[:port]`, lowercase DNS name, no path.",
                    "examples": [
                      "https://miner.example.org"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and routable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndpointSubmission"
                },
                "example": {
                  "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                  "url": "https://miner-002.0xmakase.co.jp",
                  "status": "verified",
                  "ready": true,
                  "binding": "channel",
                  "model": "qwen/qwen3-8b",
                  "accepted": true,
                  "message": "Accepted. The URL answered with a proof signed by a session key that the chain ties to this miner. It is re-verified on a schedule and dropped when it stops answering."
                }
              }
            }
          },
          "202": {
            "description": "Proof valid; recorded but not routable until the chain ties the session key to the miner",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndpointSubmission"
                },
                "example": {
                  "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                  "url": "https://miner-002.0xmakase.co.jp",
                  "status": "unbound",
                  "ready": false,
                  "binding": null,
                  "model": "qwen/qwen3-8b",
                  "accepted": false,
                  "message": "Recorded, not yet routable: the session key is not yet tied to this miner on chain. It is re-checked on a schedule and becomes verified as soon as the chain shows the key."
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 404,
                    "message": "that address is not a miner in the on-chain registry",
                    "metadata": {
                      "reason": "miner_not_found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unreachable, or the proof was rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndpointSubmission"
                },
                "example": {
                  "miner": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                  "url": "https://miner-002.0xmakase.co.jp",
                  "status": "unreachable",
                  "ready": null,
                  "binding": null,
                  "model": null,
                  "accepted": false,
                  "error": {
                    "code": 422,
                    "message": "/session/info answered 502 without a session challenge: not a live worker",
                    "metadata": {
                      "reason": "endpoint_unreachable"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 429,
                    "message": "endpoint submissions from this address: limit 30 per hour; retry in 1200 s",
                    "metadata": {
                      "reason": "rate_limited"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Directory"
        ],
        "security": []
      }
    },
    "/v1/stats": {
      "get": {
        "operationId": "getStats",
        "summary": "Network totals for the website",
        "tags": [
          "Directory"
        ],
        "description": "Miners (registered, active, calibrated, reachable, ready), models, sessions routed by this router with their settle rate, and every channel on the network from finalized chain events. No key needed.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Stats"
                },
                "example": {
                  "object": "stats",
                  "network": "devnet",
                  "finalized_block": 4494343,
                  "generated_at": "2026-11-24T03:09:16.011Z",
                  "miners": {
                    "registered": 762,
                    "active": 761,
                    "calibrated": 410,
                    "reachable": 7,
                    "ready": 1
                  },
                  "models": {
                    "verified": 6,
                    "available": 1
                  },
                  "router_sessions": {
                    "all_time": {
                      "routed": 45,
                      "settled": 19,
                      "refunded": 2,
                      "failed": 22,
                      "in_progress": 2,
                      "settle_rate": 0.905
                    },
                    "last_24h": {
                      "routed": 45,
                      "settled": 19,
                      "refunded": 2,
                      "failed": 22,
                      "in_progress": 2,
                      "settle_rate": 0.905
                    },
                    "settle_rate_note": "settled / (settled + refunded) of sessions routed by this router whose channel reached a final outcome"
                  },
                  "network_channels": {
                    "all_time": {
                      "total": 57580,
                      "resolved": 57011,
                      "settled": 14134,
                      "settle_rate": 0.248
                    },
                    "last_24h": {
                      "total": 1646,
                      "resolved": 1503,
                      "settled": 508,
                      "settle_rate": 0.338
                    },
                    "note": "every computeChannel channel on this network, from finalized chain events"
                  }
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/auth/challenge": {
      "post": {
        "operationId": "createAuthChallenge",
        "summary": "Get a challenge for a wallet to sign",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChallengeRequest"
              },
              "example": {
                "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Challenge"
                },
                "example": {
                  "challenge": "floprouter API key request\nAddress: 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS\nNetwork: devnet (0x99c172c095340ace980631f9123544c6bebd4839f3437e463533422d8be2d631)\nNonce: 3b9122934e5dc30eb8c11bee241bf24c\nIssued: 2026-11-24T03:09:16.132Z\nExpires: 2026-11-24T03:19:16.132Z\nSigning this creates an API key for this address. It does not move funds.",
                  "expires_at": "2026-11-24T03:19:16.132Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": []
      }
    },
    "/v1/auth/keys": {
      "post": {
        "operationId": "createApiKey",
        "summary": "Exchange a signed challenge for an API key",
        "tags": [
          "Auth"
        ],
        "description": "The challenge is single-use and expires after 10 minutes. The key is shown once.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyRequest"
              },
              "example": {
                "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                "challenge": "floprouter API key request\nAddress: 5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS\n...",
                "signature": "0x5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a",
                "payer": "grant",
                "name": "my agent"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewKey"
                },
                "example": {
                  "object": "api_key",
                  "id": "key_03182966a7c7",
                  "key": "fr_YOUR_API_KEY",
                  "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                  "payer_mode": "grant",
                  "name": "my agent",
                  "created_at": "2026-11-24T02:41:38.000Z",
                  "note": "Store this key now: it is shown once and only its hash is kept."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "security": []
      },
      "get": {
        "operationId": "listApiKeys",
        "summary": "List the calling wallet's keys",
        "tags": [
          "Auth"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "address": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/KeyInfo"
                      }
                    }
                  }
                },
                "example": {
                  "object": "list",
                  "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                  "data": [
                    {
                      "id": "key_03182966a7c7",
                      "prefix": "fr_CrOS",
                      "name": "e2e t-grant-user",
                      "payer_mode": "grant",
                      "created_at": "2026-11-24T02:41:38.000Z",
                      "last_used_at": "2026-11-24T03:09:16.000Z",
                      "revoked": false,
                      "revoked_at": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/v1/auth/keys/{id}": {
      "delete": {
        "operationId": "revokeApiKey",
        "summary": "Revoke a key of the calling wallet",
        "tags": [
          "Auth"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^key_[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "revoked": {
                      "const": true
                    }
                  }
                },
                "example": {
                  "id": "key_03182966a7c7",
                  "revoked": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        }
      },
      "patch": {
        "operationId": "updateApiKey",
        "summary": "Change a key's default payer mode",
        "tags": [
          "Auth"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^key_[0-9a-f]{12}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payer"
                ],
                "properties": {
                  "payer": {
                    "enum": [
                      "grant",
                      "credit"
                    ]
                  }
                }
              },
              "example": {
                "payer": "credit"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyInfo"
                },
                "example": {
                  "id": "key_03182966a7c7",
                  "prefix": "fr_CrOS",
                  "name": "e2e t-grant-user",
                  "payer_mode": "grant",
                  "created_at": "2026-11-24T02:41:38.000Z",
                  "last_used_at": "2026-11-24T03:09:16.000Z",
                  "revoked": false,
                  "revoked_at": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        }
      }
    },
    "/v1/grants/params": {
      "get": {
        "operationId": "getGrantParams",
        "summary": "The grant to sign for grant mode",
        "tags": [
          "Grants"
        ],
        "description": "Delegate address, chain limits, suggested caps, and the exact `createSession` call (arguments and SCALE call data) for the wallet to sign. With a key, for the key's wallet; without one, pass `address`. Read-only: nothing is reserved. The delegate shown is the one this wallet already granted, else the lowest router delegate with a free slot on chain; if two wallets grant its last slot at once, the chain refuses the second grant (`TooManySessions`) and asking again shows the next delegate. The router records a grant when `POST /v1/grants/sync` (or a chat request) finds it on chain.",
        "security": [
          {
            "bearer": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Wallet that will sign (when no key is sent)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrantParams"
                },
                "example": {
                  "object": "grant_params",
                  "owner": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                  "delegate": "5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7",
                  "network": "devnet",
                  "genesis_hash": "0x99c172c095340ace980631f9123544c6bebd4839f3437e463533422d8be2d631",
                  "limits": {
                    "max_session_duration_blocks": 864000,
                    "max_sessions_per_delegate": 10,
                    "max_sessions_per_owner": 10,
                    "max_rotations_per_hour": 3,
                    "epoch_blocks": 86400,
                    "circuit_breaker": {
                      "period_blocks": 60,
                      "max_txs": 100,
                      "max_spend": "250"
                    },
                    "block_time_ms": 1000,
                    "allowed_pallets": [
                      "ComputeChannel"
                    ]
                  },
                  "amounts": {
                    "spending_cap": "5",
                    "per_tx_limit": "0.5",
                    "daily_cap": "2",
                    "duration_blocks": 864000,
                    "duration_hours": 240,
                    "max_escrow_per_session": "0.5"
                  },
                  "call": {
                    "pallet": "flopSessionKeys",
                    "method": "createSession",
                    "args": [
                      "5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7",
                      "5000000000000000000",
                      "500000000000000000",
                      "2000000000000000000",
                      864000,
                      [
                        "ComputeChannel"
                      ]
                    ],
                    "args_names": [
                      "delegate",
                      "spending_cap",
                      "per_tx_limit",
                      "daily_cap",
                      "duration_blocks",
                      "allowed_pallets"
                    ]
                  },
                  "call_data": "0x5e0072c4397216285801092592606cb1e02ed8f54f45c7a3508e565e13ed6bdee57a0000f4448291634500000000000000000000b2d3595bf00600000000000000000000c84e676dc11b0000000000000000002f0d000438436f6d707574654368616e6e656c",
                  "notes": [
                    "Sign and submit this one extrinsic with the wallet that should pay for its sessions, then call POST /v1/grants/sync.",
                    "The grant lets the delegate open ComputeChannel channels for you, within the caps. It cannot transfer funds. Revoke it at any time with flopSessionKeys.revokeSession(delegate).",
                    "Every grant expires after at most 864000 blocks; sign a new one before then (GET /v1/grants shows the expiry). Granting the same delegate again replaces the old record.",
                    "Escrow is paid from your wallet on chain. The router fee is taken from your prepaid balance (GET /v1/balance), and only for sessions that settle paid. The delegate's transaction fees are paid by the router."
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/grants/sync": {
      "post": {
        "operationId": "syncGrants",
        "summary": "Re-read the calling wallet's grant from the chain",
        "tags": [
          "Grants"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrantList"
                },
                "example": {
                  "object": "list",
                  "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                  "data": [
                    {
                      "owner": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                      "delegate": "5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7",
                      "state": "active",
                      "active": true,
                      "spending_cap": "5",
                      "spent": "0",
                      "remaining": "5",
                      "per_tx_limit": "0.5",
                      "daily_cap": "2",
                      "epoch_spent": "0",
                      "epoch_room": "2",
                      "expires_at_block": 5357409,
                      "expires_in_blocks": 863066,
                      "expires_at": "2026-12-04T02:53:42.046Z",
                      "sessions_left_estimate": 200,
                      "synced_block": 4493699,
                      "synced_at": "2026-11-24T02:58:39.000Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/v1/grants": {
      "get": {
        "operationId": "listGrants",
        "summary": "The calling wallet's grant state",
        "tags": [
          "Grants"
        ],
        "description": "Lifetime and daily room, expiry, and an estimate of sessions left. Grants expire after at most `max_session_duration_blocks` (10 days on devnet); sign a new one before then. A grant cannot be renewed by the router: the chain does not let a session call the session-key pallet.",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrantList"
                },
                "example": {
                  "object": "list",
                  "address": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                  "data": [
                    {
                      "owner": "5F29vNoqgKpXxgUyz4DXifLnfAPQUQCq3ZQXGVjVbxp7sWBS",
                      "delegate": "5EfBc9f69NuPUV9zue18zeURWriF64Q9d7MN7h626D3pm2r7",
                      "state": "active",
                      "active": true,
                      "spending_cap": "5",
                      "spent": "0",
                      "remaining": "5",
                      "per_tx_limit": "0.5",
                      "daily_cap": "2",
                      "epoch_spent": "0",
                      "epoch_room": "2",
                      "expires_at_block": 5357409,
                      "expires_in_blocks": 863066,
                      "expires_at": "2026-12-04T02:53:42.046Z",
                      "sessions_left_estimate": 200,
                      "synced_block": 4493699,
                      "synced_at": "2026-11-24T02:58:39.000Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "operationId": "getBalance",
        "summary": "Prepaid balance, deposit address, recent ledger entries",
        "tags": [
          "Balance"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                },
                "example": {
                  "object": "balance",
                  "address": "5GgtRwYh75jW5WrVXEYvU24ZBXxezbmqv1h523MYDMpPv3Lk",
                  "currency": "FLOP",
                  "network": "devnet",
                  "balance": "0.18",
                  "held": "0",
                  "available": "0.18",
                  "deposit_address": "5CZb3mksqZKcnVqG2FMaEy9Phuc49uufnS4izjpgRoWeYsfB",
                  "fee_percent": 5,
                  "deposit_note": "Send a plain transfer (balances.transferKeepAlive or transferAllowDeath) from 5GgtRwYh75jW5WrVXEYvU24ZBXxezbmqv1h523MYDMpPv3Lk to the deposit address. It is credited to the sending address once its block is finalized, usually within a minute.",
                  "recent": [
                    {
                      "id": 28,
                      "kind": "refund",
                      "amount": "0.01",
                      "session_id": "drill-mwu3u9tx-da232c98",
                      "channel_id": "0x16b280463c7f824db57e16e41290ceb792d30e90fad5fc1fce9c96d288c1b246",
                      "block": 4494308,
                      "tx": "0x00e31c8c2a8d8cb617a39653502065c1f14392d78ac55bce6fe9d17f23ac9b9b",
                      "note": "escrow returned on chain (ack_expired)",
                      "at": "2026-11-24T03:09:15.000Z"
                    },
                    {
                      "id": 26,
                      "kind": "fee_debit",
                      "amount": "-0.0005",
                      "session_id": "gen-mwu43k8o-4c620dd46c46",
                      "channel_id": "0xcfa6c2a77dd2161509456d82bb907817b046915fd7473d9b0e3bcc4ad4601b75",
                      "block": 4494294,
                      "tx": "0x630bcaaf73da199fcf1e49d58a1c483d4ad3b0a2d0e3ab136e2f174d54645300",
                      "note": "router fee, 5% of escrow 0.01",
                      "at": "2026-11-24T03:08:28.000Z"
                    },
                    {
                      "id": 24,
                      "kind": "session_debit",
                      "amount": "-0.01",
                      "session_id": "gen-mwu43k8o-4c620dd46c46",
                      "channel_id": "0xcfa6c2a77dd2161509456d82bb907817b046915fd7473d9b0e3bcc4ad4601b75",
                      "block": null,
                      "tx": "0x938765935af0a517914fee2ef2d3f3943f13a5bc187694d79d59ece818317dcc",
                      "note": "escrow of the channel, paid on chain by the router wallet",
                      "at": "2026-11-24T03:05:43.000Z"
                    },
                    {
                      "id": 22,
                      "kind": "session_debit",
                      "amount": "-0.01",
                      "session_id": "drill-mwu3u9tx-da232c98",
                      "channel_id": "0x16b280463c7f824db57e16e41290ceb792d30e90fad5fc1fce9c96d288c1b246",
                      "block": null,
                      "tx": "0x481dad8f16812b634fc963ae9fa13b1750bcbae0ede94ba8dd48d8e7e155293c",
                      "note": "escrow of the channel, paid on chain by the router wallet",
                      "at": "2026-11-24T02:58:17.000Z"
                    },
                    {
                      "id": 16,
                      "kind": "fee_debit",
                      "amount": "-0.0005",
                      "session_id": "gen-mwu3lspe-bb6fda71aa60",
                      "channel_id": "0x84ac21590817c766fdca3e35cd04530024542e127ed86fc1e7afb53cdd1a9749",
                      "block": 4493379,
                      "tx": "0xccc218e9969eff1f40bc0c537a29ba3703be90c4b3fcb93d670b4e111ebd9166",
                      "note": "router fee, 5% of escrow 0.01",
                      "at": "2026-11-24T02:53:08.000Z"
                    },
                    {
                      "id": 12,
                      "kind": "session_debit",
                      "amount": "-0.01",
                      "session_id": "gen-mwu3lspe-bb6fda71aa60",
                      "channel_id": "0x84ac21590817c766fdca3e35cd04530024542e127ed86fc1e7afb53cdd1a9749",
                      "block": null,
                      "tx": "0x192c540e9f77c5909706cb6b6c48f3c5350fd610a68b21f0d6d1cb1a39518e04",
                      "note": "escrow of the channel, paid on chain by the router wallet",
                      "at": "2026-11-24T02:51:34.000Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/v1/balance/withdraw": {
      "post": {
        "operationId": "withdrawBalance",
        "summary": "Withdraw prepaid balance to the owning wallet",
        "tags": [
          "Balance"
        ],
        "description": "Sends FLOP from the deposit wallet to the wallet that owns the API key, and nowhere else. The amount is held first, so it cannot race a session or another withdrawal (one withdrawal per wallet in flight). The chain fee is estimated and taken out of the amount sent; the ledger books `withdrawal` (what left) and `withdrawal_fee` (fee actually paid). If the transfer's outcome is unknown the amount stays held until reconciled (503 `withdrawal_outcome_unknown`). At most 10 withdrawals per wallet per hour.",
        "security": [
          {
            "bearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WithdrawRequest"
              },
              "example": {
                "amount": "0.03"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent and final on chain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Withdrawal"
                },
                "example": {
                  "object": "withdrawal",
                  "id": "wd-306c854c672692e2",
                  "to": "5GgtRwYh75jW5WrVXEYvU24ZBXxezbmqv1h523MYDMpPv3Lk",
                  "status": "sent",
                  "requested": "0.03",
                  "sent": "0.027276454255",
                  "chain_fee": "0.002723545745",
                  "tx": "0xabd02d8b6cadafa9ea657b47ac88ad3296b28a5b60bbcd4b7109bec4ee895678",
                  "block": 4497940,
                  "error": null,
                  "created_at": "2026-11-24T04:08:19.000Z",
                  "balance_after": "0.1895"
                }
              }
            }
          },
          "400": {
            "description": "Invalid amount or destination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 400,
                    "message": "withdrawals go only to the wallet that owns the API key",
                    "metadata": {
                      "reason": "invalid_destination"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "description": "Not enough available balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 402,
                    "message": "available balance 0.0195 FLOP is less than 0.03",
                    "metadata": {
                      "reason": "insufficient_balance",
                      "available": "0.0195"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "A withdrawal for this wallet is in progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 409,
                    "message": "a withdrawal for this wallet is still in progress (or its outcome is being reconciled)",
                    "metadata": {
                      "reason": "withdrawal_in_progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "description": "Withdrawals unavailable, deposit wallet short, transfer failed (nothing sent) or outcome unknown (amount held)",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": 503,
                    "message": "the deposit wallet cannot pay this withdrawal right now; try a smaller amount later",
                    "metadata": {
                      "reason": "treasury_insufficient"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Sync state of the registry, event index, endpoint registry, sources and payer",
        "responses": {
          "200": {
            "description": "Health",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "status": {
                      "enum": [
                        "ok",
                        "degraded"
                      ]
                    },
                    "network": {
                      "type": "string"
                    },
                    "finalized_block": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                },
                "example": {
                  "status": "ok",
                  "network": "devnet",
                  "genesis_hash": "0x99c172c095340ace980631f9123544c6bebd4839f3437e463533422d8be2d631",
                  "rpc": [
                    "wss://rpc.devnet.flop.network"
                  ],
                  "indexer_url": "https://explorer.devnet.flop.network",
                  "uptime_s": 266,
                  "finalized_block": 4494343,
                  "registry": {
                    "synced_block": 4494065,
                    "miners": 762,
                    "active": 761,
                    "retired": 0,
                    "scored": 762,
                    "scored_block": 4494318,
                    "channels": 57580,
                    "channel_sweep_block": 4465512,
                    "models": 10
                  },
                  "event_index": {
                    "anchor_block": 4465429,
                    "forward_cursor": 4494343,
                    "backfill_cursor": 49773,
                    "backfill_done": true,
                    "backfill_floor": 49773,
                    "backfill_blocks": 4415656,
                    "backfill_ms": 10048522,
                    "events": 137597,
                    "channels_with_exact_outcome": 57011,
                    "channels_with_indexer_outcome_only": 0,
                    "explorer_cross_check": {
                      "compared": 56295,
                      "disagree": 0
                    },
                    "undecodable_blocks": 0,
                    "rpc_calls_since_start": 602,
                    "last_follow_at": "2026-11-24T03:09:14.272Z",
                    "last_ok_at": "2026-11-24T03:09:14.273Z",
                    "consecutive_failures": 0,
                    "recoveries_since_start": 0,
                    "last_error": null,
                    "last_error_at": null
                  },
                  "endpoints": {
                    "candidate_urls": 125,
                    "verified": 7,
                    "verified_ready": 1,
                    "unbound": 5,
                    "dead": 1
                  },
                  "offers": {
                    "live": 48,
                    "with_venue": 0,
                    "polled_at": "2026-11-24T03:08:57.063Z"
                  },
                  "sources": {
                    "seed-issues-2026-11-23": {
                      "at": 1795489490597,
                      "claims": 15,
                      "fresh": 0,
                      "ok": true
                    },
                    "owner-input-2026-11-24": {
                      "at": 1795489490600,
                      "claims": 7,
                      "fresh": 0,
                      "ok": true
                    },
                    "github-issues": {
                      "at": 1795489491421,
                      "claims": 235,
                      "fresh": 0,
                      "ok": true
                    },
                    "technocore:gpu-miners": {
                      "at": 1795489492595,
                      "claims": 1,
                      "fresh": 0,
                      "ok": true
                    },
                    "technocore:inference-agents": {
                      "at": 1795489493315,
                      "claims": 0,
                      "fresh": 0,
                      "ok": true
                    },
                    "technocore:flop-devnet-faucet": {
                      "at": 1795489494044,
                      "claims": 0,
                      "fresh": 0,
                      "ok": true
                    },
                    "flopradar-leaderboard": {
                      "at": 1795489494599,
                      "claims": 55,
                      "fresh": 1,
                      "ok": true
                    }
                  },
                  "payer": {
                    "router_wallet": "5GmdxzsmKFi31y1qXYJfxmeBvDoUhxR6D4DnVxbAUjQ8RNnw",
                    "modes": [
                      "grant",
                      "credit"
                    ],
                    "demo": false,
                    "delegates": 1
                  },
                  "billing": {
                    "deposit_address": "5CZb3mksqZKcnVqG2FMaEy9Phuc49uufnS4izjpgRoWeYsfB",
                    "fee_percent": 5
                  },
                  "sessions": {
                    "total": 45,
                    "in_flight": 0,
                    "open_channels": 1
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Service"
        ],
        "description": "Sync state of every part. Never requires the origin header. `event_index.last_error` is the last error seen; `consecutive_failures` and `last_ok_at` say whether it is current.",
        "security": []
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "openapi",
        "summary": "This document",
        "responses": {
          "200": {
            "description": "OpenAPI 3.1",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "openapi": "3.1.0",
                  "info": {
                    "title": "floprouter API",
                    "version": "1.0.0"
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Service"
        ],
        "security": []
      }
    },
    "/v1/providers": {
      "get": {
        "operationId": "listProviders",
        "summary": "Providers: a thin alias view of /v1/miners",
        "tags": [
          "Directory"
        ],
        "security": [],
        "description": "Miners with a proven session endpoint, in the provider shape (`slug` = miner address). The miner directory is `GET /v1/miners`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "name": "miner-002.0xmakase.co.jp",
                      "slug": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                      "privacy_policy_url": null,
                      "terms_of_service_url": null,
                      "status_page_url": null,
                      "headquarters": null,
                      "datacenters": [],
                      "flop": {
                        "address": "5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92",
                        "score": 67.5,
                        "active": true,
                        "endpoints": [
                          {
                            "url": "https://miner-002.0xmakase.co.jp",
                            "model": "qwen/qwen3-8b",
                            "liveness": "down",
                            "ready": true
                          }
                        ],
                        "details": "/v1/miners/5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92"
                      }
                    },
                    {
                      "name": "miner.ecamliflop.fyi",
                      "slug": "5HdTbhVY9jZCsfJVFENYF89hRfkBvoby2YxPest3XLLRhnrt",
                      "privacy_policy_url": null,
                      "terms_of_service_url": null,
                      "status_page_url": null,
                      "headquarters": null,
                      "datacenters": [],
                      "flop": {
                        "address": "5HdTbhVY9jZCsfJVFENYF89hRfkBvoby2YxPest3XLLRhnrt",
                        "score": 59.7,
                        "active": true,
                        "endpoints": [
                          {
                            "url": "https://miner.ecamliflop.fyi",
                            "model": "qwen/qwen2.5-0.5b-instruct",
                            "liveness": "down",
                            "ready": true
                          }
                        ],
                        "details": "/v1/miners/5HdTbhVY9jZCsfJVFENYF89hRfkBvoby2YxPest3XLLRhnrt"
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/key": {
      "get": {
        "operationId": "getKey",
        "summary": "The calling key: usage in FLOP and limits",
        "tags": [
          "Auth"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "`limit` is null: spending is bounded by the wallet's prepaid balance (GET /v1/balance) and, in grant mode, by the grant's caps. Usage counts sessions paid through this key (UTC day, week from Monday, month).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  }
                },
                "example": {
                  "data": {
                    "label": "e2e t-credit-user",
                    "limit": null,
                    "limit_remaining": null,
                    "limit_reset": null,
                    "include_byok_in_limit": false,
                    "usage": 0.042,
                    "usage_daily": 0.042,
                    "usage_weekly": 0.042,
                    "usage_monthly": 0.042,
                    "byok_usage": 0,
                    "byok_usage_daily": 0,
                    "byok_usage_weekly": 0,
                    "byok_usage_monthly": 0,
                    "is_free_tier": false,
                    "is_management_key": false,
                    "is_provisioning_key": false,
                    "expires_at": null,
                    "creator_user_id": "5GgtRwYh75jW5WrVXEYvU24ZBXxezbmqv1h523MYDMpPv3Lk",
                    "rate_limit": {
                      "requests": 120,
                      "interval": "1m",
                      "note": "chat requests: 20 per minute per key"
                    },
                    "flop": {
                      "key_id": "key_29962a4854f7",
                      "address": "5GgtRwYh75jW5WrVXEYvU24ZBXxezbmqv1h523MYDMpPv3Lk",
                      "payer_mode": "credit",
                      "currency": "FLOP",
                      "created_at": "2026-11-24T02:41:42.000Z",
                      "note": "This key has no spending limit of its own; spending is bounded by the wallet's prepaid FLOP balance (GET /api/v1/balance) and, in grant mode, by the grant's caps."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Wallet API key `fr_...` from `POST /v1/auth/keys`."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "`code` is the HTTP status; `metadata.reason` is floprouter's specific reason.",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "examples": [
                  400,
                  401,
                  402,
                  403,
                  404,
                  408,
                  409,
                  413,
                  429,
                  502,
                  503
                ]
              },
              "message": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "examples": [
                      "insufficient_balance",
                      "grant_expired",
                      "all_attempts_failed",
                      "no_provider_supports_parameters",
                      "tools_not_supported",
                      "model_not_found",
                      "rate_limited",
                      "withdrawal_in_progress"
                    ]
                  },
                  "session_id": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        }
      },
      "ProviderPreferences": {
        "type": "object",
        "description": "Provider preferences. A provider is a FLOP miner; its slug is the miner's SS58 address (the endpoint host is accepted as an alias).",
        "properties": {
          "order": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "only": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ignore": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allow_fallbacks": {
            "type": "boolean",
            "default": true,
            "description": "false: only the listed miners (with order), or only the top-ranked miner (without)."
          },
          "sort": {
            "oneOf": [
              {
                "enum": [
                  "price",
                  "throughput",
                  "latency",
                  "reliability"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "by": {
                    "enum": [
                      "price",
                      "throughput",
                      "latency",
                      "reliability"
                    ]
                  },
                  "partition": {
                    "enum": [
                      "model",
                      "none"
                    ]
                  }
                }
              }
            ],
            "description": "price: all miners of a model are priced alike, default order applies; throughput and latency: router-measured time to the verified reply; reliability (default): on-chain score."
          },
          "max_price": {
            "type": "object",
            "description": "In FLOP: prompt and completion per million tokens, request per request. A model above it is skipped.",
            "properties": {
              "prompt": {
                "type": "number"
              },
              "completion": {
                "type": "number"
              },
              "request": {
                "type": "number"
              },
              "image": {
                "type": "number"
              }
            }
          },
          "require_parameters": {
            "type": "boolean",
            "default": false,
            "description": "Refuse (503) instead of ignoring parameters the model does not support."
          },
          "data_collection": {
            "enum": [
              "allow",
              "deny"
            ],
            "default": "allow",
            "description": "deny cannot be met: miners keep signed session evidence for audit and settlement (503)."
          },
          "zdr": {
            "type": "boolean",
            "description": "true cannot be met (503), as data_collection deny."
          },
          "quantizations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "bf16"
              ]
            ]
          },
          "preferred_min_throughput": {
            "description": "Accepted and ignored."
          },
          "preferred_max_latency": {
            "description": "Accepted and ignored."
          },
          "enforce_distillable_text": {
            "type": "boolean",
            "description": "Accepted and ignored."
          }
        }
      },
      "ChatRequest": {
        "type": "object",
        "required": [
          "messages"
        ],
        "additionalProperties": true,
        "description": "Model parameters follow each model's `supported_parameters` (today `max_tokens`): others are ignored and named in `X-Floprouter-Ignored-Parameters`, or refused with `provider.require_parameters`. A non-empty `tools` gets 404 (no model is served with tool use yet). `tool` messages, non-text parts, `prompt`, `n > 1` and enabled `plugins` get 400. `transforms`, `user`, `session_id`, `metadata`, `trace`, `debug`, `service_tier` are accepted and ignored.",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "qwen/qwen3-8b"
            ],
            "description": "Model id from `GET /v1/models` (required; there is no account default)."
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "enum": [
                    "developer",
                    "system",
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": [
                    "string",
                    "array",
                    "null"
                  ],
                  "description": "Text, or an array of `text` parts (joined)."
                }
              }
            }
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32768,
            "default": 256,
            "description": "Sets the escrow together with the prompt size. `max_completion_tokens` is accepted as an alias."
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "stream_options": {
            "type": "object",
            "description": "Accepted; the usage chunk is always sent."
          },
          "provider": {
            "$ref": "#/components/schemas/ProviderPreferences"
          },
          "flop": {
            "type": "object",
            "properties": {
              "payer": {
                "enum": [
                  "grant",
                  "credit"
                ],
                "description": "Override the key's payer mode for this request."
              },
              "fallback_payer": {
                "enum": [
                  "credit"
                ],
                "description": "Grant mode only: if no miner can be served through the grant (no live signed offer, or the grant cannot pay), run the request in credit mode instead. Off by default."
              },
              "wait_for_settlement": {
                "type": "boolean",
                "default": false,
                "description": "Also wait for the finalized on-chain settlement before answering, within the response deadline (about 85 s). The settlement usually takes 1 to 4 minutes, so the answer may still say `settling`; poll `GET /v1/sessions/{id}`."
              }
            }
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Fallback models, tried in order after `model` when it has no serving provider or the request is too large for it; never after any output. The response `model` names the model used."
          },
          "route": {
            "enum": [
              "fallback"
            ]
          },
          "temperature": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "top_p": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "top_k": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "frequency_penalty": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "presence_penalty": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "repetition_penalty": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "min_p": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "top_a": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "seed": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "stop": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "response_format": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "logit_bias": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "logprobs": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "top_logprobs": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "reasoning": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "reasoning_effort": {
            "description": "Ignored unless the model lists it in supported_parameters (none does today); with provider.require_parameters the request is refused."
          },
          "tools": {
            "type": "array",
            "description": "Non-empty: 404, no endpoint supports tool use yet."
          },
          "plugins": {
            "type": "array",
            "description": "Enabled plugins are refused (400): none exists here."
          },
          "transforms": {
            "type": "array",
            "description": "Accepted and ignored."
          },
          "user": {
            "type": "string",
            "description": "Accepted and ignored."
          }
        }
      },
      "ChatResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Session id."
          },
          "object": {
            "const": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "description": "The miner (provider slug: its address)."
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "const": "assistant"
                    },
                    "content": {
                      "type": "string"
                    }
                  }
                },
                "finish_reason": {
                  "enum": [
                    "stop",
                    "length",
                    "tool_calls",
                    "content_filter",
                    "error"
                  ]
                },
                "logprobs": {
                  "type": "null"
                },
                "native_finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "From the miner's signed receipt."
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "completion_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              },
              "prompt_tokens_details": {
                "type": "object",
                "properties": {
                  "cached_tokens": {
                    "type": "integer"
                  }
                }
              },
              "completion_tokens_details": {
                "type": "object",
                "properties": {
                  "reasoning_tokens": {
                    "type": "integer"
                  }
                }
              },
              "cost": {
                "type": "number",
                "description": "In FLOP: escrow plus router fee. Final once the session settles; 0 when refunded."
              },
              "is_byok": {
                "type": "boolean"
              },
              "cost_details": {
                "type": "object",
                "properties": {
                  "upstream_inference_cost": {
                    "type": "number"
                  },
                  "upstream_inference_prompt_cost": {
                    "type": "number"
                  },
                  "upstream_inference_completions_cost": {
                    "type": "number"
                  },
                  "router_fee": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "final": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "flop": {
            "$ref": "#/components/schemas/Session"
          }
        }
      },
      "Session": {
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string"
          },
          "status": {
            "enum": [
              "running",
              "settling",
              "settled",
              "refunded",
              "recovering",
              "failed",
              "fraud",
              "voided"
            ],
            "description": "`settling`: reply delivered, settlement not yet final. `settled`: miner paid on chain. `refunded`: escrow returned."
          },
          "model": {
            "type": "string"
          },
          "model_hash": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "channel_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "On-chain compute channel (0x + 64 hex)."
          },
          "miner": {
            "type": [
              "string",
              "null"
            ]
          },
          "endpoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "via": {
            "enum": [
              "offer",
              "force",
              null
            ],
            "description": "How the channel was opened: against the miner's signed offer, or by force-open."
          },
          "payer": {
            "type": "object",
            "properties": {
              "address": {
                "type": "string",
                "description": "Account recorded on chain as the channel's payer (`agent`)."
              },
              "kind": {
                "enum": [
                  "router-wallet",
                  "session-key"
                ]
              },
              "mode": {
                "enum": [
                  "grant",
                  "credit",
                  "demo",
                  "operator"
                ]
              },
              "fallback_from": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Set when the request fell back from grant to credit mode."
              },
              "account": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Wallet that owns the API key."
              },
              "delegate": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Grant mode: the router delegate that signed the open."
              },
              "note": {
                "type": "string"
              }
            }
          },
          "escrow": {
            "type": [
              "string",
              "null"
            ],
            "description": "FLOP escrowed for the request. A cooperative settlement pays all of it.",
            "examples": [
              "0.01"
            ]
          },
          "miner_paid": {
            "type": [
              "string",
              "null"
            ],
            "description": "Amount paid to the miner, from the finalized `Settled` event. Null until settled.",
            "examples": [
              "0.01"
            ]
          },
          "router_fee": {
            "type": "object",
            "properties": {
              "percent": {
                "type": "number"
              },
              "amount": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Fee for this session's escrow."
              },
              "charged": {
                "type": "boolean"
              },
              "charged_amount": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "enum": [
                  "pending",
                  "charged",
                  "not_charged",
                  "not_billed"
                ],
                "description": "`pending` until the channel's outcome is final; `charged` when it settled paid; `not_charged` when it was refunded or failed; `not_billed` for demo sessions."
              },
              "note": {
                "type": "string"
              }
            }
          },
          "currency": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "on_chain": {
            "type": "object",
            "properties": {
              "open_block": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "outcome": {
                "enum": [
                  "settled",
                  "timed_out",
                  "ack_expired",
                  "refunded",
                  "voided",
                  "fraud",
                  null
                ]
              },
              "outcome_block": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "outcome_tx": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "completion_tokens": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "finish_reason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Attempt"
            }
          },
          "links": {
            "type": "object",
            "properties": {
              "channel": {
                "type": "string",
                "format": "uri"
              },
              "session": {
                "type": "string"
              }
            }
          },
          "wire": {
            "type": [
              "string",
              "null"
            ],
            "description": "Chat envelope version sent to the miner (`flop.chat-turn.v2` renders the model's chat template)."
          },
          "reply": {
            "type": [
              "object",
              "null"
            ],
            "description": "The verified reply (`role`, `content`, `finish_reason`), shown to the wallet that owns the session. Absent for other callers."
          },
          "reply_visible": {
            "type": "boolean"
          },
          "ignored_parameters": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Request parameters this model ignored (see its supported_parameters)."
          }
        }
      },
      "Attempt": {
        "type": "object",
        "description": "One try on one miner. Every attempt is recorded.",
        "properties": {
          "n": {
            "type": "integer"
          },
          "miner": {
            "type": "string"
          },
          "endpoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "via": {
            "type": [
              "string",
              "null"
            ]
          },
          "channel_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "escrow": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal amount in FLOP.",
            "examples": [
              "0.01"
            ]
          },
          "status": {
            "type": "string"
          },
          "stage": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ]
          },
          "miner_paid": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal amount in FLOP.",
            "examples": [
              "0.01"
            ]
          },
          "refunded": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal amount in FLOP.",
            "examples": [
              "0.01"
            ]
          },
          "open_block": {
            "type": [
              "integer",
              "null"
            ]
          },
          "outcome_block": {
            "type": [
              "integer",
              "null"
            ]
          },
          "outcome_tx": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_output_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "recovery": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Recovery extrinsics sent for this channel (expire_force_open, timeout, force_settle, finalize)."
          }
        }
      },
      "Model": {
        "type": "object",
        "description": "A model; FLOP facts under `flop`. Prices are FLOP per token.",
        "properties": {
          "id": {
            "type": "string"
          },
          "canonical_slug": {
            "type": "string"
          },
          "hugging_face_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "created": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          },
          "context_length": {
            "type": "integer"
          },
          "architecture": {},
          "pricing": {
            "type": "object",
            "description": "FLOP per token (decimal strings).",
            "additionalProperties": {
              "type": "string"
            }
          },
          "top_provider": {},
          "per_request_limits": {},
          "supported_parameters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "default_parameters": {},
          "knowledge_cutoff": {},
          "expiration_date": {},
          "endpoints": {},
          "links": {},
          "flop": {
            "type": "object",
            "description": "Model hash, registry version, precision, providers reachable and ready, minimum charge per request, escrow per 1,000 tokens, router fee, chat wire, pricing note."
          },
          "available": {
            "deprecated": true,
            "description": "Deprecated alias of the value under `flop`, kept for one release."
          },
          "miners_ready": {
            "deprecated": true,
            "description": "Deprecated alias of the value under `flop`, kept for one release."
          },
          "miners_reachable": {
            "deprecated": true,
            "description": "Deprecated alias of the value under `flop`, kept for one release."
          },
          "params_billion": {
            "deprecated": true,
            "description": "Deprecated alias of the value under `flop`, kept for one release."
          }
        }
      },
      "Miner": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "score": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "Router score from on-chain facts only. Higher is better."
          },
          "rank": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Position by score among registered miners."
          },
          "registered": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "retired": {
            "type": "boolean"
          },
          "blacklisted": {
            "type": "boolean"
          },
          "stake": {
            "type": "object",
            "properties": {
              "self": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              },
              "delegated": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              },
              "sponsored": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              },
              "total": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              }
            }
          },
          "calibration": {
            "type": "object",
            "properties": {
              "live": {
                "type": "boolean"
              },
              "cap_gflops_per_sec": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "version": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "tier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accepted_at_block": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "expires_at_block": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "capacity": {
            "type": "object",
            "properties": {
              "cap_gflops_per_sec": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "busy_channels": {
                "type": "integer"
              }
            }
          },
          "slashing": {
            "type": "object",
            "properties": {
              "strikes": {
                "type": "integer"
              },
              "total_slashed": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              },
              "failed_acks": {
                "type": "integer"
              },
              "failed_offer_opens": {
                "type": "integer"
              }
            }
          },
          "history": {
            "type": [
              "object",
              "null"
            ],
            "description": "Raw settlement facts.",
            "properties": {
              "sessions_resolved": {
                "type": "integer"
              },
              "settled": {
                "type": "integer"
              },
              "timed_out": {
                "type": "integer"
              },
              "ack_expired": {
                "type": "integer"
              },
              "refunded": {
                "type": "integer"
              },
              "voided": {
                "type": "integer"
              },
              "fraud": {
                "type": "integer"
              },
              "settle_rate": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "distinct_payers": {
                "type": "integer"
              },
              "settled_volume": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              },
              "last_settled_block": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "last_opened_block": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "outcome_basis": {
                "type": "object",
                "description": "How many of the outcomes come from finalized chain events (exact), the explorer indexer (provisional) or chain storage.",
                "properties": {
                  "chain_events": {
                    "type": "integer"
                  },
                  "explorer_indexer": {
                    "type": "integer"
                  },
                  "chain_storage": {
                    "type": "integer"
                  }
                }
              },
              "unclassified": {
                "type": "integer",
                "description": "Closed channels whose outcome is not yet known from any source."
              }
            }
          },
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "hash": {
                  "type": "string"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "evidence": {
                  "type": "array",
                  "items": {
                    "enum": [
                      "signed-info-proof",
                      "signed-offer",
                      "channel-history",
                      "model-registry"
                    ]
                  }
                },
                "channels": {
                  "type": "integer"
                },
                "settled": {
                  "type": "integer"
                }
              }
            }
          },
          "live_offers": {
            "type": "integer"
          },
          "endpoint": {
            "type": [
              "string",
              "object",
              "null"
            ]
          },
          "router_measured": {
            "type": "object",
            "description": "Measured by this router; not part of the score.",
            "properties": {
              "reachable": {
                "type": "boolean"
              },
              "ready": {
                "type": "boolean"
              },
              "probe_success_rate": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "proof_latency_ms": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "sessions_attempted": {
                "type": "integer"
              },
              "sessions_with_output": {
                "type": "integer"
              },
              "sessions_settled": {
                "type": "integer"
              },
              "session_success_rate": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "first_output_ms": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Mean time to the first verified output."
              }
            }
          },
          "links": {
            "type": "object"
          },
          "endpoints": {
            "type": "array",
            "description": "Detail view only.",
            "items": {
              "type": "object"
            }
          },
          "recent_channels": {
            "type": "array",
            "description": "Detail view only.",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "MinerList": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "network": {
            "type": "string"
          },
          "finalized_block": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Miner"
            }
          },
          "score_note": {
            "type": "string"
          }
        }
      },
      "VerifiedPairs": {
        "type": "object",
        "description": "Returned for `reachable=true`: proven (miner, endpoint) pairs with fresh liveness.",
        "properties": {
          "object": {
            "const": "list"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "network": {
            "type": "string"
          },
          "rpc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "indexer": {
            "type": "string"
          },
          "finalized_block": {
            "type": "integer"
          },
          "rule": {
            "type": "string"
          },
          "counts": {
            "type": "object"
          },
          "total": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "address": {
                  "type": "string"
                },
                "endpoint": {
                  "type": "string"
                },
                "models": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "serving_now": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ready": {
                  "type": "boolean"
                },
                "reliability": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Settled / resolved sessions."
                },
                "reliability_detail": {
                  "type": [
                    "object",
                    "null"
                  ]
                },
                "status": {
                  "enum": [
                    "live",
                    "down",
                    "unverified"
                  ]
                },
                "source": {
                  "type": "string"
                },
                "sources": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                },
                "proof": {
                  "type": "object"
                },
                "registry": {
                  "type": "object"
                },
                "score": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "EndpointSubmission": {
        "type": "object",
        "properties": {
          "miner": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "status": {
            "enum": [
              "verified",
              "unbound",
              "rejected",
              "unreachable"
            ]
          },
          "accepted": {
            "type": "boolean"
          },
          "ready": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "binding": {
            "enum": [
              "offer",
              "channel",
              null
            ],
            "description": "How the chain ties the proof's session key to the miner."
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "object"
          }
        }
      },
      "ChatPending": {
        "type": "object",
        "description": "Returned with HTTP 202 when no verified reply exists within the response deadline. The session continues; poll it.",
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "object": {
            "const": "chat.completion.pending"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "status": {
            "const": "pending"
          },
          "message": {
            "type": "string"
          },
          "poll": {
            "type": [
              "string",
              "null"
            ]
          },
          "flop": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Session"
              },
              {
                "type": "null"
              }
            ]
          },
          "generation": {
            "type": [
              "string",
              "null"
            ],
            "description": "Generation lookup for the same session."
          }
        }
      },
      "ChallengeRequest": {
        "type": "object",
        "required": [
          "address"
        ],
        "properties": {
          "address": {
            "type": "string",
            "description": "SS58 address of the wallet."
          }
        }
      },
      "Challenge": {
        "type": "object",
        "properties": {
          "challenge": {
            "type": "string",
            "description": "Exact text to sign (UTF-8 bytes; a `<Bytes>…</Bytes>` wrapper as added by browser extensions is accepted)."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "KeyRequest": {
        "type": "object",
        "required": [
          "address",
          "challenge",
          "signature"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "challenge": {
            "type": "string"
          },
          "signature": {
            "type": "string",
            "description": "0x-hex sr25519 or ed25519 signature of the challenge by the wallet."
          },
          "payer": {
            "enum": [
              "grant",
              "credit"
            ],
            "default": "grant"
          },
          "name": {
            "type": "string",
            "maxLength": 64
          }
        }
      },
      "NewKey": {
        "type": "object",
        "properties": {
          "object": {
            "const": "api_key"
          },
          "id": {
            "type": "string"
          },
          "key": {
            "type": "string",
            "description": "Shown once; only its hash is stored."
          },
          "address": {
            "type": "string"
          },
          "payer_mode": {
            "enum": [
              "grant",
              "credit"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "KeyInfo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "payer_mode": {
            "enum": [
              "grant",
              "credit"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "revoked": {
            "type": "boolean"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "GrantParams": {
        "type": "object",
        "properties": {
          "object": {
            "const": "grant_params"
          },
          "owner": {
            "type": "string"
          },
          "delegate": {
            "type": "string",
            "description": "Router delegate key to name in the grant. Kept per wallet."
          },
          "network": {
            "type": "string"
          },
          "genesis_hash": {
            "type": "string"
          },
          "limits": {
            "type": "object",
            "description": "Chain constants of the flopSessionKeys pallet.",
            "properties": {
              "max_session_duration_blocks": {
                "type": "integer"
              },
              "max_sessions_per_delegate": {
                "type": "integer"
              },
              "max_sessions_per_owner": {
                "type": "integer"
              },
              "max_rotations_per_hour": {
                "type": "integer"
              },
              "epoch_blocks": {
                "type": "integer"
              },
              "circuit_breaker": {
                "type": "object"
              },
              "block_time_ms": {
                "type": "integer"
              },
              "allowed_pallets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "amounts": {
            "type": "object",
            "description": "Suggested caps (decimal FLOP) and duration."
          },
          "call": {
            "type": "object",
            "properties": {
              "pallet": {
                "const": "flopSessionKeys"
              },
              "method": {
                "const": "createSession"
              },
              "args": {
                "type": "array",
                "description": "Raw units for amounts."
              },
              "args_names": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "call_data": {
            "type": "string",
            "description": "SCALE-encoded call (0x hex): sign and submit it as an extrinsic from the owner wallet."
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Grant": {
        "type": "object",
        "properties": {
          "owner": {
            "type": "string"
          },
          "delegate": {
            "type": "string"
          },
          "state": {
            "enum": [
              "assigned",
              "active",
              "expired",
              "revoked"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "spending_cap": {
            "type": [
              "string",
              "null"
            ]
          },
          "spent": {
            "type": [
              "string",
              "null"
            ]
          },
          "remaining": {
            "type": [
              "string",
              "null"
            ]
          },
          "per_tx_limit": {
            "type": [
              "string",
              "null"
            ]
          },
          "daily_cap": {
            "type": [
              "string",
              "null"
            ]
          },
          "epoch_spent": {
            "type": [
              "string",
              "null"
            ]
          },
          "epoch_room": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at_block": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expires_in_blocks": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Estimated from the block time."
          },
          "sessions_left_estimate": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Sessions at the minimum escrow that the lifetime and daily room still allow."
          },
          "synced_block": {
            "type": [
              "integer",
              "null"
            ]
          },
          "synced_at": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "GrantList": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "address": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Grant"
            }
          }
        }
      },
      "LedgerEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "kind": {
            "enum": [
              "deposit",
              "session_debit",
              "refund",
              "fee_debit",
              "withdrawal",
              "withdrawal_fee"
            ]
          },
          "amount": {
            "type": "string",
            "description": "Signed decimal FLOP."
          },
          "session_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "channel_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "block": {
            "type": [
              "integer",
              "null"
            ]
          },
          "tx": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "at": {
            "type": "string"
          }
        }
      },
      "Balance": {
        "type": "object",
        "properties": {
          "object": {
            "const": "balance"
          },
          "address": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "balance": {
            "type": "string"
          },
          "held": {
            "type": "string",
            "description": "Reserved for sessions in flight."
          },
          "available": {
            "type": "string"
          },
          "deposit_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "fee_percent": {
            "type": "number"
          },
          "deposit_note": {
            "type": "string"
          },
          "recent": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerEntry"
            }
          },
          "withdrawals": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "min": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "note": {
                "type": "string"
              },
              "recent": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Withdrawal"
                }
              }
            }
          }
        }
      },
      "SessionList": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "address": {
            "type": "string"
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Session"
            },
            "description": "Sessions without their `attempts`."
          }
        }
      },
      "Stats": {
        "type": "object",
        "properties": {
          "object": {
            "const": "stats"
          },
          "network": {
            "type": "string"
          },
          "finalized_block": {
            "type": "integer"
          },
          "generated_at": {
            "type": "string"
          },
          "miners": {
            "type": "object",
            "properties": {
              "registered": {
                "type": "integer"
              },
              "active": {
                "type": "integer"
              },
              "calibrated": {
                "type": "integer"
              },
              "reachable": {
                "type": "integer"
              },
              "ready": {
                "type": "integer"
              }
            }
          },
          "models": {
            "type": "object",
            "properties": {
              "verified": {
                "type": "integer"
              },
              "available": {
                "type": "integer"
              }
            }
          },
          "router_sessions": {
            "type": "object"
          },
          "network_channels": {
            "type": "object"
          }
        }
      },
      "Withdrawal": {
        "type": "object",
        "properties": {
          "object": {
            "const": "withdrawal"
          },
          "id": {
            "type": "string"
          },
          "to": {
            "type": "string",
            "description": "Always the wallet that owns the API key."
          },
          "status": {
            "enum": [
              "pending",
              "sent",
              "failed",
              "unknown"
            ]
          },
          "requested": {
            "type": "string"
          },
          "sent": {
            "type": [
              "string",
              "null"
            ],
            "description": "Requested amount minus the chain fee estimate."
          },
          "chain_fee": {
            "type": [
              "string",
              "null"
            ],
            "description": "Fee actually paid (TransactionFeePaid)."
          },
          "tx": {
            "type": [
              "string",
              "null"
            ]
          },
          "block": {
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "balance_after": {
            "type": "string"
          }
        }
      },
      "WithdrawRequest": {
        "type": "object",
        "required": [
          "amount"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal FLOP, or \"all\" for the whole available balance.",
            "examples": [
              "0.03",
              "all"
            ]
          },
          "to": {
            "type": "string",
            "description": "Optional; must equal the owning wallet."
          }
        }
      }
    },
    "responses": {
      "E400": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 400,
                "message": "each message needs a role of system, developer, user or assistant (tool messages are not supported)",
                "metadata": {
                  "reason": "invalid_message"
                }
              }
            }
          }
        }
      },
      "E401": {
        "description": "Missing or invalid key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 401,
                "message": "a wallet API key is required (Authorization: Bearer fr_...); see POST /v1/auth/challenge",
                "metadata": {
                  "reason": "unauthorized"
                }
              }
            }
          }
        }
      },
      "E402": {
        "description": "The payer cannot cover this request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 402,
                "message": "prepaid balance 0 FLOP available cannot cover 0.0105 FLOP (escrow plus router fee); send FLOP to the deposit address, see GET /v1/balance",
                "metadata": {
                  "reason": "insufficient_balance",
                  "available": "0",
                  "required": "0.0105",
                  "session_id": "gen-mwu3pgp7-1130f87d046b"
                }
              }
            }
          }
        }
      },
      "E403": {
        "description": "The request did not come through the public endpoint (origin header missing or wrong)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 403,
                "message": "requests must come through the public endpoint",
                "metadata": {
                  "reason": "forbidden"
                }
              }
            }
          }
        }
      },
      "E404": {
        "description": "Not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 404,
                "message": "no such session",
                "metadata": {
                  "reason": "session_not_found"
                }
              }
            }
          }
        }
      },
      "E409": {
        "description": "Conflict",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 409,
                "message": "this wallet already has 10 active keys; revoke one first",
                "metadata": {
                  "reason": "too_many_keys"
                }
              }
            }
          }
        }
      },
      "E413": {
        "description": "Body too large",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 413,
                "message": "request body exceeds 524288 bytes",
                "metadata": {
                  "reason": "body_too_large"
                }
              }
            }
          }
        }
      },
      "E429": {
        "description": "Rate limit, concurrency cap, grant daily cap or demo budget",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 429,
                "message": "chat requests for this key: limit 20 per minute; retry in 41 s",
                "metadata": {
                  "reason": "rate_limited"
                }
              }
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait."
          }
        }
      },
      "E503": {
        "description": "No provider could complete the request, or the service is restarting. Not 502: client SDKs retry 502 at once, and each retry can cost an on-chain fee.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": 503,
                "message": "no miner completed the request after 1 attempt(s): 5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92: computeChannel.MinerCapacityFullyReserved: D-0542: the miner's live capacity reservations leave no room for this channel's rate.",
                "metadata": {
                  "reason": "all_attempts_failed",
                  "session_id": "gen-mwu3pgp7-1130f87d046b"
                }
              }
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait."
          }
        }
      }
    }
  }
}