{
  "openapi": "3.1.0",
  "info": {
    "title": "floprouter API",
    "version": "1.0.0",
    "description": "OpenAI-compatible chat completions over FLOP Network direct inference sessions: wallet-signed API keys, two payer modes, a prepaid balance for the router fee, and a chain-derived miner directory.\n\n**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.\n- `credit`: the router's wallet pays the session on chain; escrow and router fee are taken from the prepaid balance.\n\n**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. The router fee is `fee_percent` of the session's escrow, charged only when the channel settles paid.\n\n**Timing**: a proxy in front of the public API closes responses idle for 100 s. Non-streaming calls answer within about 85 s: with the verified reply, or with HTTP 202 and the session id to poll (`GET /v1/sessions/{id}`). Waiting for the on-chain settlement is opt-in (`flop.wait_for_settlement`) and cut to the same deadline. Streams send a keep-alive comment at least every 15 s.\n\n**Streaming**: `stream: true` gives OpenAI `chat.completion.chunk` events ending in `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; the finish chunk is sent only after verification. Workers on devnet today (0.1.418) send the reply in one piece at the end of the turn, so a stream shows the role chunk, keep-alives, then the whole reply.\n\n**Amounts** are decimal strings in FLOP. **Errors** use the OpenAI shape `{\"error\": {\"message\", \"type\", \"code\"}}`; 429 and 503 carry `Retry-After`.\n\n**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.",
    "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": "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": "Run one paid chat completion on a FLOP miner",
        "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; once output exists (or any text reached a streaming client) there is no retry. 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.",
        "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?"
                      }
                    ]
                  }
                },
                "credit_with_fallback": {
                  "value": {
                    "model": "qwen/qwen3-8b",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Who pays for this request?"
                      }
                    ],
                    "max_tokens": 32,
                    "flop": {
                      "payer": "grant",
                      "fallback_payer": "credit"
                    }
                  }
                },
                "stream": {
                  "value": {
                    "model": "qwen/qwen3-8b",
                    "stream": true,
                    "max_tokens": 40,
                    "messages": [
                      {
                        "role": "user",
                        "content": "Name a primary colour."
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "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."
                      },
                      "finish_reason": "stop",
                      "logprobs": null
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 29,
                    "completion_tokens": 8,
                    "total_tokens": 37
                  },
                  "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"
                    }
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": ": floprouter stream open\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,\"logprobs\":null}]}\n\n: keep-alive\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,\"logprobs\":null}]}\n\ndata: {\"id\":\"gen-mwu43k8o-4c620dd46c46\",\"object\":\"chat.completion.chunk\",\"created\":1795489493,\"model\":\"qwen/qwen3-8b\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\",\"logprobs\":null}],\"provider\":\"5HKiGNFSqSyEMVMjjr8JBKkkppytaqFZCRm27KGbCeHhUq92\"}\n\ndata: {\"id\":\"gen-mwu43k8o-4c620dd46c46\",\"object\":\"chat.completion.chunk\",\"created\":1795489493,\"model\":\"qwen/qwen3-8b\",\"choices\":[],\"usage\":{\"prompt_tokens\":28,\"completion_tokens\":3,\"total_tokens\":31},\"flop\":{\"session_id\":\"gen-mwu43k8o-4c620dd46c46\",\"status\":\"settling\"}}\n\ndata: [DONE]\n\n"
              }
            }
          },
          "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 session continues. Poll GET /v1/sessions/gen-mwu3v1s3-ab700a21edac until reply is set, or use stream: true.",
                  "poll": "/v1/sessions/gen-mwu3v1s3-ab700a21edac",
                  "flop": null
                }
              }
            }
          },
          "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/models": {
      "get": {
        "operationId": "listModels",
        "summary": "Verified models in the on-chain registry, with availability",
        "responses": {
          "200": {
            "description": "Models",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    }
                  }
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "nousresearch/arete-27b",
                      "object": "model",
                      "created": 0,
                      "owned_by": "flop-network",
                      "name": "NousResearch/Arete-27B",
                      "hash": "0xd1fa9165a2f43b9a87a53b1acad8dfa9b593ebd532a461e095d3a1a440db8598",
                      "version": "1",
                      "params_billion": 27,
                      "precisions": [
                        "BF16"
                      ],
                      "gflops_per_token": 52,
                      "miners_reachable": 0,
                      "miners_ready": 0,
                      "available": false,
                      "pricing": {
                        "escrow_per_1000_tokens": "0.05",
                        "basis": "token_price",
                        "tariff_floor_per_1000_tokens": "0.000000000000052001",
                        "router_fee_percent": 5
                      }
                    },
                    {
                      "id": "qwen/qwen2.5-0.5b-instruct",
                      "object": "model",
                      "created": 0,
                      "owned_by": "flop-network",
                      "name": "Qwen/Qwen2.5-0.5B-Instruct",
                      "hash": "0x1a52c1abe781db051e70ae357f72bb70161ca0c092df0b618f22a9292ba63306",
                      "version": "1",
                      "params_billion": 1,
                      "precisions": [
                        "BF16"
                      ],
                      "gflops_per_token": 2,
                      "miners_reachable": 4,
                      "miners_ready": 0,
                      "available": false,
                      "pricing": {
                        "escrow_per_1000_tokens": "0.05",
                        "basis": "token_price",
                        "tariff_floor_per_1000_tokens": "0.000000000000002001",
                        "router_fee_percent": 5
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "tags": [
          "Directory"
        ],
        "security": []
      }
    },
    "/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": {
                    "message": "sort must be one of score, reliability, settle_rate, sessions, stake, latency, capacity",
                    "type": "invalid_request_error",
                    "code": "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": {
                    "message": "no such miner in the on-chain registry",
                    "type": "invalid_request_error",
                    "code": "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": {
                    "message": "that address is not a miner in the on-chain registry",
                    "type": "invalid_request_error",
                    "code": "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": "endpoint_unreachable",
                    "message": "/session/info answered 502 without a session challenge: not a live worker"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "endpoint submissions from this address: limit 30 per hour; retry in 1200 s",
                    "type": "rate_limit_error",
                    "code": "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`.",
        "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/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": []
          },
          {}
        ]
      }
    },
    "/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": []
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Wallet API key `fr_...` from `POST /v1/auth/keys`."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message",
              "code"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "examples": [
                  "invalid_request_error",
                  "authentication_error",
                  "payment_required",
                  "rate_limit_error",
                  "server_error"
                ]
              },
              "code": {
                "type": "string",
                "examples": [
                  "unauthorized",
                  "insufficient_balance",
                  "grant_required",
                  "grant_expired",
                  "grant_exhausted",
                  "grant_per_tx_limit",
                  "grant_daily_cap",
                  "insufficient_funds",
                  "no_miner_available",
                  "all_attempts_failed",
                  "rate_limited",
                  "too_many_concurrent",
                  "demo_budget_exhausted",
                  "shutting_down",
                  "model_not_found",
                  "escrow_limit",
                  "body_too_large",
                  "forbidden"
                ]
              },
              "session_id": {
                "type": "string"
              },
              "available": {
                "type": "string"
              },
              "required": {
                "type": "string"
              }
            }
          }
        }
      },
      "ProviderPreferences": {
        "type": "object",
        "description": "Miner choice. Default is automatic.",
        "properties": {
          "order": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Miner addresses to try first, in this order."
          },
          "only": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Use only these miners."
          },
          "ignore": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Never use these miners."
          },
          "sort": {
            "enum": [
              "reliability",
              "latency"
            ],
            "default": "reliability",
            "description": "`reliability`: by on-chain score. `latency`: by router-measured latency."
          },
          "allow_fallbacks": {
            "type": "boolean",
            "default": true,
            "description": "With `order`: whether other miners may be tried after the listed ones."
          }
        }
      },
      "ChatRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": true,
        "description": "Other OpenAI fields are accepted and ignored; sampling is fixed by each model's on-chain decode policy. `tools` (non-empty), `tool` messages, non-text content parts and `n > 1` are rejected.",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "qwen/qwen3-8b"
            ]
          },
          "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}`."
              }
            }
          }
        }
      },
      "ChatResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Session id."
          },
          "object": {
            "const": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "description": "Miner 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"
                  ]
                },
                "logprobs": {
                  "type": "null"
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "completion_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          },
          "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"
          }
        }
      },
      "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",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "model"
          },
          "name": {
            "type": "string"
          },
          "hash": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "params_billion": {
            "type": "integer"
          },
          "precisions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "gflops_per_token": {
            "type": "integer"
          },
          "miners_reachable": {
            "type": "integer"
          },
          "miners_ready": {
            "type": "integer"
          },
          "available": {
            "type": "boolean"
          },
          "pricing": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "escrow_per_1000_tokens": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              },
              "basis": {
                "type": "string"
              },
              "tariff_floor_per_1000_tokens": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Decimal amount in FLOP.",
                "examples": [
                  "0.01"
                ]
              },
              "router_fee_percent": {
                "type": "number"
              }
            }
          },
          "created": {
            "type": "integer"
          },
          "owned_by": {
            "type": "string"
          }
        }
      },
      "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"
              }
            ]
          }
        }
      },
      "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"
            ]
          },
          "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"
            }
          }
        }
      },
      "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"
          }
        }
      }
    },
    "responses": {
      "E400": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "each message needs a role of system, developer, user or assistant (tool messages are not supported)",
                "type": "invalid_request_error",
                "code": "invalid_message"
              }
            }
          }
        }
      },
      "E401": {
        "description": "Missing or invalid key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "a wallet API key is required (Authorization: Bearer fr_...); see POST /v1/auth/challenge",
                "type": "authentication_error",
                "code": "unauthorized"
              }
            }
          }
        }
      },
      "E402": {
        "description": "The payer cannot cover this request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "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",
                "type": "payment_required",
                "code": "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": {
                "message": "requests must come through the public endpoint",
                "type": "invalid_request_error",
                "code": "forbidden"
              }
            }
          }
        }
      },
      "E404": {
        "description": "Not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "no such session",
                "type": "invalid_request_error",
                "code": "session_not_found"
              }
            }
          }
        }
      },
      "E409": {
        "description": "Conflict",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "this wallet already has 10 active keys; revoke one first",
                "type": "invalid_request_error",
                "code": "too_many_keys"
              }
            }
          }
        }
      },
      "E413": {
        "description": "Body too large",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "request body exceeds 524288 bytes",
                "type": "invalid_request_error",
                "code": "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": {
                "message": "chat requests for this key: limit 20 per minute; retry in 41 s",
                "type": "rate_limit_error",
                "code": "rate_limited"
              }
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait."
          }
        }
      },
      "E503": {
        "description": "No miner could complete the request, or the service is restarting. Not 502: OpenAI SDKs retry 502 at once, and each retry can cost an on-chain fee.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "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.",
                "type": "server_error",
                "code": "all_attempts_failed",
                "session_id": "gen-mwu3pgp7-1130f87d046b"
              }
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait."
          }
        }
      }
    }
  }
}