Skip to Content
Docs

Get started

Quickstart

Send a first request in three steps with plain HTTP.

1. Get a key

Open the account page, connect a Polkadot wallet (polkadot-js, Talisman or SubWallet), and sign the login message. Signing it is free and moves no funds. You get a key that starts with fr_. It is shown once.

Shell
export FLOPROUTER_API_KEY=fr_...

A new key makes your wallet the payer on chain, which needs one more signature: the grant, on the same page. To skip the grant, switch the key to Balance there and deposit a little FLOP. See payer modes.

2. Pick a model

Shell
curl https://api.floprouter.com/v1/models

A model with available: true has at least one ready miner. The models page shows the same list. No key is needed for this call.

3. Send a request

curl https://api.floprouter.com/v1/chat/completions \
  -H "Authorization: Bearer $FLOPROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen/qwen3-8b",
    "messages": [{"role": "user", "content": "What is a payment channel?"}],
    "max_tokens": 128
  }'

To use an SDK or framework instead, see SDK compatibility.

The call returns when the miner's reply is verified, usually in 15 to 50 s. Set client timeouts to 120 s or more. max_tokens sizes the escrow, so keep it close to what you need.

4. Read the response

The body is a chat completion with two extra fields: provider, the miner that served it, and flop, the record of the session.

JSON
{
  "id": "gen-mwto3ds1-0811fd3833f3",
  "object": "chat.completion",
  "model": "qwen/qwen2.5-0.5b-instruct",
  "provider": "5HdTbhVY9jZCsfJVFENYF89hRfkBvoby2YxPest3XLLRhnrt",
  "choices": [{"index": 0, "message": {"role": "assistant", "content": "..."}, "finish_reason": "length"}],
  "usage": {"prompt_tokens": 6, "completion_tokens": 24, "total_tokens": 30},
  "flop": {
    "session_id": "gen-mwto3ds1-0811fd3833f3",
    "status": "settling",
    "channel_id": "0x96cc8fd277657749a32b2acd6b0ee035fe5837785663a8d31ce4179212f3cddb",
    "miner": "5HdTbhVY9jZCsfJVFENYF89hRfkBvoby2YxPest3XLLRhnrt",
    "via": "force",
    "payer": {"address": "5Gmdxzsm...", "kind": "router-wallet"},
    "escrow": "0.01",
    "miner_paid": null,
    "router_fee": {"percent": 5, "amount": "0.0005", "charged": false, "status": "pending"},
    "on_chain": {"open_block": 4467284, "outcome": null, "outcome_block": null, "outcome_tx": null}
  }
}

This is an abridged real response from devnet. Amounts are decimal strings in FLOP.

5. Watch it settle

Shell
curl https://api.floprouter.com/v1/sessions/gen-mwto3ds1-0811fd3833f3

status moves from settling to settled, and miner_paid and on_chain.outcome_tx fill in, 2 to 4 minutes after the reply. The channel is on the explorer at https://explorer.devnet.flop.network/channels/<channel_id>.

Next