Start

Quick start

Send your first request in three steps. Only the base URL and the key differ from the OpenAI API.

View as Markdown

1. Get a key

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

Shell
export FLOPROUTER_API_KEY=fr_...

A new key makes your wallet the payer on chain. That needs one more signature: the grant, on the same page. If you would rather not sign it, 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

Each model lists miners_ready. A model with available: true has at least one ready miner. The models page shows the same list.

3. Send a request

Shell
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,
    "flop": {"wait_for_settlement": false}
  }'
Python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.floprouter.com/v1",
    api_key=os.environ["FLOPROUTER_API_KEY"],
)

reply = client.chat.completions.create(
    model="qwen/qwen3-8b",
    messages=[{"role": "user", "content": "What is a payment channel?"}],
    max_tokens=128,
    extra_body={"flop": {"wait_for_settlement": False}},
)

print(reply.choices[0].message.content)
print(reply.model_extra["flop"]["channel_id"])
JavaScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.floprouter.com/v1",
  apiKey: process.env.FLOPROUTER_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "qwen/qwen3-8b",
  messages: [{ role: "user", content: "What is a payment channel?" }],
  max_tokens: 128,
  flop: { wait_for_settlement: false },
});

console.log(reply.choices[0].message.content);
console.log(reply.flop.channel_id);

In TypeScript the extra flop field is not in the SDK's types. Add // @ts-expect-error above it, or pass the body through a variable typed as any.

The call returns as soon as the reply is verified, usually in 15 to 50 s. "wait_for_settlement": false is the default; it is written out here so you can see the option. Setting it to true waits for the on-chain settlement too, which takes 2 to 4 minutes more. For text as it is produced, use streaming.

4. Read the response

The body is a normal chat.completion. Two fields are added: provider, the miner that served the request, 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},
    "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, on_chain.outcome_block and on_chain.outcome_tx fill in. Open the channel on the explorer at https://explorer.devnet.flop.network/channels/<channel_id>.

Next

  • Routing: choose miners yourself.
  • Payer modes: keep your own wallet as the payer on chain.
  • Connect: SDKs, agent frameworks, editor tools, MCP and the CLI.