> ## Documentation Index
> Fetch the complete documentation index at: https://docs.floprouter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Router fees, prepaid balance, deposit address, recent ledger entries

> `fees` shows the router fees accrued, collected and owed. The prepaid balance is optional in grant mode (the fee grant covers the router fee); it is needed for credit mode, or to prepay fees instead of using the fee grant.



## OpenAPI

````yaml /openapi.json get /v1/balance
openapi: 3.1.0
info:
  title: floprouter Unified API
  version: 1.0.0
  description: >-
    The floprouter Unified API routes chat requests to FLOP Network miners and
    settles each one on chain. One request format covers every model: chat
    completions with `provider` preferences and a `models` fallback list, model
    objects, a generation lookup, one error format and one streaming format.
    FLOP's own concepts have their own routes: miners, sessions on payment
    channels, session-key grants, the prepaid FLOP balance, settlement and
    on-chain attribution. **Base paths**: `/api/v1/...` and `/v1/...` serve the
    same routes; this document lists them under `/v1`. **Payer modes** (per key,
    overridable per request with `flop.payer`):

    - `grant`: the caller's wallet is the on-chain payer (channel `agent`) of
    every session. The wallet signs one batch (`GET /v1/grants/params` returns
    the exact call data): a `flopSessionKeys.createSession` grant to the
    router's compute delegate (ComputeChannel only) and one to a fee delegate
    (Balances only, used for the router's own fee). The router then opens
    channels within the caps and collects its fee from the wallet to the
    router's fee address. No deposit is needed. The escrow is paid on chain from
    the wallet. A wallet that prefers to prepay can deposit instead; the fee
    then comes from the prepaid balance. - `credit`: the router's wallet pays
    the session on chain; escrow and router fee are taken from the prepaid
    balance. **Balance**: optional in grant mode, required in credit mode. Fund
    it with a plain FLOP transfer from your wallet to `deposit_address` (`GET
    /v1/balance`); it is credited once the block is finalized. Withdraw with
    `POST /v1/balance/withdraw` (to the owning wallet only). Every balance can
    be recomputed from finalized chain state: billed sessions carry an encrypted
    ledger tag on chain, and the service checks its ledger against the chain
    continuously. The router fee is the larger of `fee_percent` of the session's
    escrow or `min_router_fee` (0.012 FLOP on testnet; it pays the chain fee of
    opening the channel), charged only when the channel settles paid (in grant
    mode it accrues, then is collected from the wallet through the fee grant;
    the `fees` object on GET /v1/balance and GET /v1/grants shows accrued,
    collected and owed). Both are in GET /v1/models, GET /v1/balance and
    /health. **One request shape for every model**: the router chooses the chat
    envelope, template version, token limits and parameter support per model
    from what the chain and the miner's signed info say. Parameters a model does
    not support (see its `supported_parameters`) are ignored and named in
    `X-Floprouter-Ignored-Parameters`; `provider.require_parameters` refuses
    them instead. **Cost** (`usage.cost`, in FLOP): the escrow (prompt plus
    `max_tokens` at the model's price, paid in full on a cooperative settle)
    plus the router fee. Final once the session settles; a refunded session
    costs 0. **Timing**: a proxy in front closes responses idle for 100 s.
    Non-streaming calls answer within about 85 s: with the verified reply, or
    with HTTP 202 and the generation id to poll (`GET /v1/generation?id=`).
    Streams send `: FLOPROUTER PROCESSING` comments at least every 15 s.
    **Streaming**: chat completion chunks ending in a usage chunk (one choice
    repeating `finish_reason`) and `data: [DONE]`. Text is forwarded as the
    miner streams it and is provisional until the turn's signed receipt is
    verified at the end of the turn. A mid-stream error is one chunk with a
    top-level `error` and `finish_reason: "error"`. **Errors**: `{"error":
    {"code": <HTTP status>, "message", "metadata": {"reason", ...}}}`; 429 and
    503 carry `Retry-After`. **Miner score**: computed by the router from
    on-chain facts only (settlement history, volume, stake, slashing record,
    calibration state). The raw facts are returned beside it. **Client
    libraries**: the chat endpoint uses the widely used chat completions request
    and response format, so any client library for that format works with
    `baseURL` set to `https://api.floprouter.com/api/v1` and a floprouter key.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://api.floprouter.com
    description: API used by this site
security: []
tags:
  - name: Inference
    description: Chat completions and sessions.
  - name: Models
    description: >-
      Models, with their prices, limits and supported parameters, and the miners
      serving each.
  - name: Auth
    description: Wallet-signed API keys.
  - name: Grants
    description: 'Grant payer mode: the wallet stays the on-chain payer.'
  - name: Balance
    description: Router fees, prepaid balance and ledger.
  - name: Directory
    description: No key needed.
  - name: Service
    description: Health and this document.
paths:
  /v1/balance:
    get:
      tags:
        - Balance
      summary: Router fees, prepaid balance, deposit address, recent ledger entries
      description: >-
        `fees` shows the router fees accrued, collected and owed. The prepaid
        balance is optional in grant mode (the fee grant covers the router fee);
        it is needed for credit mode, or to prepay fees instead of using the fee
        grant.
      operationId: getBalance
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Balance'
              example:
                object: balance
                address: 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty
                currency: FLOP
                network: testnet
                fees:
                  mode: prepaid
                  accrued: '0'
                  collected: '0'
                  owed: '0'
                  last_collection: null
                  next_collection_at: null
                balance: '0.18'
                held: '0'
                available: '0.18'
                deposit_address: 5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL
                fee_percent: 5
                min_router_fee: '0.012'
                deposit_note: >-
                  Send a plain transfer (balances.transferKeepAlive or
                  transferAllowDeath) from
                  5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty 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.000256'
                    session_id: drill-mwu3u9tx-da232c98
                    channel_id: >-
                      0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
                    block: 4494308
                    tx: >-
                      0x0000000000000000000000000000000000000000000000000000000000000000
                    note: escrow returned on chain (ack_expired)
                    at: '2026-11-24T03:09:15.000Z'
                  - id: 26
                    kind: fee_debit
                    amount: '-0.012'
                    session_id: gen-example-0002
                    channel_id: >-
                      0x0000000000000000000000000000000000000000000000000000000000000000
                    block: 4494294
                    tx: >-
                      0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
                    note: >-
                      router fee, the 0.012 minimum (5% of escrow 0.000256 is
                      less)
                    at: '2026-11-24T03:08:28.000Z'
                  - id: 24
                    kind: session_debit
                    amount: '-0.01'
                    session_id: gen-example-0002
                    channel_id: >-
                      0x0000000000000000000000000000000000000000000000000000000000000000
                    block: null
                    tx: >-
                      0x0000000000000000000000000000000000000000000000000000000000000000
                    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: >-
                      0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
                    block: null
                    tx: >-
                      0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
                    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.012'
                    session_id: gen-example-0004
                    channel_id: >-
                      0x0000000000000000000000000000000000000000000000000000000000000000
                    block: 4493379
                    tx: >-
                      0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
                    note: >-
                      router fee, the 0.012 minimum (5% of escrow 0.000256 is
                      less)
                    at: '2026-11-24T02:53:08.000Z'
                  - id: 12
                    kind: session_debit
                    amount: '-0.01'
                    session_id: gen-example-0004
                    channel_id: >-
                      0x0000000000000000000000000000000000000000000000000000000000000000
                    block: null
                    tx: >-
                      0x0000000000000000000000000000000000000000000000000000000000000000
                    note: escrow of the channel, paid on chain by the router wallet
                    at: '2026-11-24T02:51:34.000Z'
                finality:
                  best_block: 4502990
                  finalized_block: 4502985
                  lag_blocks: 5
                  waiting: false
                  max_lag_blocks: 30
        '401':
          $ref: '#/components/responses/E401'
      security:
        - bearer: []
components:
  schemas:
    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
        min_router_fee:
          type: string
          description: >-
            Smallest router fee per billed request in FLOP. The fee is the
            larger of fee_percent of the escrow or this.
        deposit_note:
          type: string
        recent:
          type: array
          items:
            $ref: '#/components/schemas/LedgerEntry'
        withdrawals:
          type: object
          properties:
            enabled:
              type: boolean
            min:
              type:
                - string
                - 'null'
            note:
              type: string
            recent:
              type: array
              items:
                $ref: '#/components/schemas/Withdrawal'
        finality:
          $ref: '#/components/schemas/Finality'
        fees:
          $ref: '#/components/schemas/Fees'
    LedgerEntry:
      type: object
      properties:
        id:
          type: integer
        kind:
          enum:
            - deposit
            - session_debit
            - refund
            - fee_debit
            - fee_accrued
            - fee_collected
            - fee_deposit_reserved
            - fee_deposit_paid
            - withdrawal
            - withdrawal_fee
        amount:
          type: string
          description: Signed decimal FLOP.
        session_id:
          type:
            - string
            - 'null'
        channel_id:
          type:
            - string
            - 'null'
        block:
          type:
            - integer
            - 'null'
        tx:
          type:
            - string
            - 'null'
        note:
          type:
            - string
            - 'null'
        at:
          type: string
    Withdrawal:
      type: object
      properties:
        object:
          const: withdrawal
        id:
          type: string
        to:
          type: string
          description: Always the wallet that owns the API key.
        status:
          enum:
            - pending
            - submitted
            - sent
            - failed
            - unknown
          description: >-
            pending: held, not yet signed; submitted: signed and sent to the
            network; sent: final; failed: nothing left the wallet; unknown:
            signed, outcome not yet seen (the hold stays until the chain shows
            it).
        requested:
          type: string
        sent:
          type:
            - string
            - 'null'
          description: Requested amount minus the chain fee estimate.
        chain_fee:
          type:
            - string
            - 'null'
          description: Fee actually paid (TransactionFeePaid).
        tx:
          type:
            - string
            - 'null'
        block:
          type:
            - integer
            - 'null'
        error:
          type:
            - string
            - 'null'
        created_at:
          type: string
        balance_after:
          type: string
        poll:
          type: string
    Finality:
      type: object
      properties:
        best_block:
          type:
            - integer
            - 'null'
        finalized_block:
          type:
            - integer
            - 'null'
        lag_blocks:
          type:
            - integer
            - 'null'
        waiting:
          type: boolean
          description: true while the lag is above api.maxFinalityLagBlocks
        max_lag_blocks:
          type: integer
        note:
          type: string
    Fees:
      type: object
      description: >-
        The wallet's router fees. Amounts are decimal FLOP strings; `accrued`
        and `collected` are cumulative.
      properties:
        mode:
          enum:
            - grant_accrual
            - prepaid
          description: >-
            `grant_accrual`: the wallet has an active fee grant, fees accrue and
            the router collects them from the wallet. `prepaid`: fees are taken
            from the prepaid balance.
        accrued:
          type: string
          description: Fees earned by settled sessions, in total.
        collected:
          type: string
          description: >-
            Fees paid so far (collected through the fee grant or paid from a
            deposit).
        owed:
          type: string
          description: >-
            accrued minus collected. At the router's limit (the `max_owed` in a
            402 `fees_owed`) new requests are refused until the wallet signs the
            grant batch again or deposits.
        last_collection:
          type:
            - object
            - 'null'
          description: The most recent collection from the wallet; null before the first.
          properties:
            tx:
              type: string
              description: Transaction hash of the transfer.
            block:
              type: integer
            amount:
              type: string
        next_collection_at:
          type:
            - string
            - 'null'
          description: >-
            Owed amount at which the router collects (also earlier when the fee
            grant is close to expiry). null in prepaid mode.
    Error:
      type: object
      description: >-
        `code` is the HTTP status; `metadata.reason` is floprouter's specific
        reason.
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: integer
              examples:
                - 400
                - 401
                - 402
                - 403
                - 404
                - 408
                - 409
                - 413
                - 429
                - 502
                - 503
            message:
              type: string
            metadata:
              type: object
              properties:
                reason:
                  type: string
                  examples:
                    - insufficient_balance
                    - fees_owed
                    - grant_expired
                    - all_attempts_failed
                    - no_provider_supports_parameters
                    - model_not_found
                    - rate_limited
                    - withdrawal_in_progress
                    - invalid_tools
                session_id:
                  type: string
              additionalProperties: true
  responses:
    E401:
      description: Missing or invalid key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: 401
              message: >-
                a wallet API key is required (Authorization: Bearer fr_...); see
                POST /v1/auth/challenge
              metadata:
                reason: unauthorized
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: Wallet API key `fr_...` from `POST /v1/auth/keys`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.