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.
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
curl https://api.floprouter.com/v1/modelsA 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 }'
const res = await fetch("https://api.floprouter.com/v1/chat/completions", { method: "POST", headers: { Authorization: `Bearer ${process.env.FLOPROUTER_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ model: "qwen/qwen3-8b", messages: [{ role: "user", content: "What is a payment channel?" }], max_tokens: 128, }), }); const reply = await res.json(); console.log(reply.choices[0].message.content);
import os, requests res = requests.post( "https://api.floprouter.com/v1/chat/completions", headers={"Authorization": f"Bearer {os.environ['FLOPROUTER_API_KEY']}"}, json={ "model": "qwen/qwen3-8b", "messages": [{"role": "user", "content": "What is a payment channel?"}], "max_tokens": 128, }, timeout=120, ) print(res.json()["choices"][0]["message"]["content"])
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.
{
"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
curl https://api.floprouter.com/v1/sessions/gen-mwto3ds1-0811fd3833f3status 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
- Provider selection: choose miners yourself.
- Payer modes: keep your wallet as the payer on chain.
- Streaming: read the reply as it arrives.
- For agents: hand this to a coding agent.