> ## 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.

# Quickstart

> Send a first request in three steps with plain HTTP.

Using a coding agent?

Paste this prompt into Claude Code, Cursor, Codex or any LLM. It points the agent at the skill file, which has the exact steps, shapes and checks.

## 1. Get a key

Open the [account page](https://floprouter.com/account/), 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.

```bash theme={null}
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](https://docs.floprouter.com/payer-modes.md).

## 2. Pick a model

```bash theme={null}
curl https://api.floprouter.com/v1/models
```

A model with `available: true` has at least one ready miner. The [models page](https://floprouter.com/models/) shows the same list. No key is needed for this call.

## 3. Send a request

```bash curl theme={null}
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
  }'
```

```js fetch theme={null}
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);
```

```python Python theme={null}
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](https://docs.floprouter.com/compatibility.md).

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 theme={null}
{
  "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

```bash theme={null}
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

* [Provider selection](https://docs.floprouter.com/routing.md): choose miners yourself.
* [Payer modes](https://docs.floprouter.com/payer-modes.md): keep your wallet as the payer on chain.
* [Streaming](https://docs.floprouter.com/streaming.md): read the reply as it arrives.
* [For agents](https://docs.floprouter.com/for-agents.md): hand this to a coding agent.


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