# Coronium: instructions for an AI agent

<!-- facts:begin sentence -->
Infrastructure for AI agents to act on the web and on real devices: mobile and residential proxies with real IP addresses, and next phones, Macs and browsers an agent can drive.

One account, one balance, one file to read.
<!-- facts:end sentence -->

One account and one US dollar balance cover every product, and an agent uses the same kind of account as a person. Peer network proxies are available: you send web traffic over HTTP or SOCKS5 through residential and mobile devices and pay per GB. The Products section of [/llms.txt](/llms.txt) gives the state of every other product, and every call is in [/openapi.json](/openapi.json).

Every path below is on the base URL you were given, or on the address you read this file from. The commands use curl and jq. Each block runs on its own, in a new shell if need be: it sets `umask 077`, so only you can read the files it writes, and sets `BASE` to https://coronium.ai unless you exported `BASE` with your base URL first.

## Rules

<!-- facts:begin part.rules -->
- Send JSON with `Content-Type: application/json`.
- Every refusal is a JSON object with `code`, `cause` and `fix`. Read `fix` and send what it names.
- Money and byte counts are decimal strings. 1 USD is `1000000` micro-USD.
- An account has three secrets: `credential`, `accessCode` and the session cookie, and a device adds its `deviceSecret` and any enrolment `token`. The commands in these guides write each to a file only you can read and pass it to curl on its standard input or from a file, never on a command line. Never print one, and never put one in a prompt, a log or a chat message. The assistant at `POST /app/api/assistant` refuses a message that holds the credential or the access code.
- Ask your person before you spend money, replace the credential or the access code, or ask for a payout.
- A country with no devices online is on request. Make usernames for it anyway: the service records the request, and the answer's `stock.status` reads `on_request`.
- coronium.ai is in private preview until its public launch. If a call answers `403` with the code `private_preview`, the site is not open to you yet: tell your person.
<!-- facts:end part.rules -->

## Steps

<!-- facts:begin part.account -->
1. Create an account with `POST /app/api/signup`. It takes no details. Run this as it stands: it keeps the answer and the session cookie in two files and prints only the account id, or the refusal code.

```
umask 077
BASE=${BASE:-https://coronium.ai}
curl -sS -c coronium.cookies -H 'Content-Type: application/json' -d '{}' "$BASE/app/api/signup" -o coronium-account.json
jq -r '.accountId // .code' coronium-account.json
```

`coronium-account.json` now holds `accountId`, `credential` and `accessCode`, each shown this once. If the code printed is `registration_closed`, the operator has not opened registration, so you use your person's account. Ask your person to write its access code and its credential into `coronium-account.json` as `{"accessCode": "<access code>", "credential": "<credential>"}`, then sign in as step 2 says, which adds `accountId`. The service shows a credential only when it makes one. If your person no longer has it, they replace it with `POST /app/api/credential`, and strings made with the old one stop working.

2. Sign in with the access code. A new account is signed in already. Repeat this when a call answers `sign_in_required`, or on another machine. The first command writes the sign-in request to `coronium-login.json`, and stops with an error, sending nothing, if `coronium-account.json` holds no access code. The second answers `{"signedIn":true}`. The third adds `accountId` to `coronium-account.json` and stops with an error if the session read names no account.

```
umask 077
BASE=${BASE:-https://coronium.ai}
jq -c '{code: ((.accessCode | strings | select(. != "")) // error("no accessCode in coronium-account.json"))}' coronium-account.json > coronium-login.json &&
curl -sS -c coronium.cookies -H 'Content-Type: application/json' -d @- "$BASE/app/api/login" < coronium-login.json &&
curl -sS -b coronium.cookies "$BASE/app/api/dashboard" | jq --slurpfile account coronium-account.json '$account[0] + {accountId: ((.account.id | strings | select(. != "")) // error("no account in the session read: sign in again"))}' > coronium-account.next && mv coronium-account.next coronium-account.json
```
<!-- facts:end part.account -->

3. Read the price list with `GET /app/api/prices`. It needs no account. Each tier lists its countries and the devices online in each. A count under five reads `few`.

```
umask 077
BASE=${BASE:-https://coronium.ai}
curl -sS "$BASE/app/api/prices"
```

4. Read the stock of one country, here Germany, with `GET /app/api/proxy/stock?country=de`. It lists the IP classes, carriers, states and cities a username can ask for.

```
umask 077
BASE=${BASE:-https://coronium.ai}
curl -sS -b coronium.cookies "$BASE/app/api/proxy/stock?country=de"
```

5. Make proxy usernames with `POST /app/api/proxy/spawn`. Each string in the answer holds `{credential}`, and the service never prints the credential again. The second command fills it in from the account file and writes the finished strings to `coronium-proxies.txt`.

```
umask 077
BASE=${BASE:-https://coronium.ai}
curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d '{"count": 1, "pool": "peer", "country": "de", "protocol": "http", "format": "url", "rotation": "none"}' "$BASE/app/api/proxy/spawn" -o coronium-proxies.json
jq -r --slurpfile account coronium-account.json '(($account[0].credential | strings | select(. != "")) // error("no credential in coronium-account.json")) as $credential | .strings[] | sub("[{]credential[}]"; $credential)' coronium-proxies.json > coronium-proxies.txt
```

6. Read the balance with `GET /app/api/billing`. `state` is `active`, `unfunded`, `suspended`, `byte_cap` or `traffic_stopped`. An account with no funds carries no traffic once charging is on. To add funds, follow step 7 with your person or step 8 from your own wallet.

```
umask 077
BASE=${BASE:-https://coronium.ai}
curl -sS -b coronium.cookies "$BASE/app/api/billing"
```

7. Add funds with your person. The first block asks for a quote, which names an amount and owes nothing, keeps it in `coronium-quote.json` and prints it, or the refusal. A quote lasts 30 minutes, and a repeat with the same `requestId` answers with the same quote. `provider` is `coingate` for crypto or `stripe` for a card. Only one whose `configured` is `true` in `providers` of `GET /app/api/billing` takes a quote; one with `false` is refused with `provider_not_configured`, and every quote with `topups_closed` while charging is off; nothing is charged either way.

```
umask 077
BASE=${BASE:-https://coronium.ai}
curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d '{"provider": "coingate", "usdMicros": "5000000", "requestId": "topup-1"}' "$BASE/app/api/billing/quotes" -o coronium-quote.json
jq '{quoteId, usdMicros, expiresAt, code, cause, fix}' coronium-quote.json
```

Show your person `usdMicros` and wait for their yes. Only then run the second block, which confirms the quote kept in `coronium-quote.json`, and give them `checkoutUrl` to pay at. It stops with an error, sending nothing, if the file holds no quote. Confirming the same quote again answers with the same checkout.

```
umask 077
BASE=${BASE:-https://coronium.ai}
jq -c '{quoteId: ((.quoteId | strings) // error("no quoteId in coronium-quote.json: ask for a quote first")), confirm: true}' coronium-quote.json > coronium-confirm.json &&
curl -sS -b coronium.cookies -H 'Content-Type: application/json' -d @- "$BASE/app/api/billing/topups" < coronium-confirm.json | jq '{checkoutUrl, state, code, cause, fix}'
```

8. Pay from your own wallet. `POST /v1/topup` takes the account id without its dashes and an amount, needs no cookie, and answers `402` with x402 and MPP offers. The block stops with an error, sending nothing, if `coronium-account.json` holds no account id. How to pay one is in [/guides/agent-payments.md](/guides/agent-payments.md). The operator has not switched it on yet: until then it answers `503`, offers nothing and charges nothing.

```
umask 077
BASE=${BASE:-https://coronium.ai}
jq -c '{accountId: (((.accountId | strings | select(. != "")) // error("no accountId in coronium-account.json: run step 2")) | gsub("-"; "")), usdMicros: "5000000"}' coronium-account.json > coronium-topup.json &&
curl -sS -i -H 'Content-Type: application/json' -d @- "$BASE/v1/topup" < coronium-topup.json
```

9. Read where to connect with `GET /app/api/proxy`. `endpoint.state` is `open` or `closed`. While it is closed no buyer traffic is carried, and the strings from step 5 also hold `{host}` and `{port}`.

```
umask 077
BASE=${BASE:-https://coronium.ai}
curl -sS -b coronium.cookies "$BASE/app/api/proxy"
```

10. Check a route. This call takes the credential as a Bearer header and no cookie. The first command writes the header to `coronium-bearer.txt`, and stops with an error, sending nothing, if `coronium-account.json` holds no credential. Add `"live": true` to the body to send one billed request to the operator's test origin.

```
umask 077
BASE=${BASE:-https://coronium.ai}
jq -r '"Authorization: Bearer " + ((.credential | strings | select(. != "")) // error("no credential in coronium-account.json"))' coronium-account.json > coronium-bearer.txt &&
curl -sS -H @- -H 'Content-Type: application/json' -d "$(jq -c '{username: .usernames[0]}' coronium-proxies.json)" "$BASE/app/api/proxy/test" < coronium-bearer.txt
```

## Not built yet

<!-- facts:begin packages.list -->
- Not built yet: MCP tools under the namespace `ai.coronium`, reached with a credential limited to what the agent may do; `@coronium-ai/sdk`, a typed client over the same HTTP API; and `@coronium-ai/cli`, for sign-up, sign-in and proxy strings from a terminal. Whether anything is published under one of these names, npm and the MCP registry answer.
<!-- facts:end packages.list -->

So everything above is plain HTTP. A product marked "Not available yet" in /llms.txt takes a request. Signed in, send `POST /app/api/demand/device` with `{"kind": "<product id>"}` and an optional one-line `note`; the ids are the `kind` enum of that call in /openapi.json. The request is recorded, and nothing is ordered or charged. Your person can also send one from [/devices](/devices).

Other guides: [buyers](/guides/buyers.md), [buying a private modem line](/guides/private-proxies.md), [device owners](/guides/device-owners.md), [usernames](/guides/usernames.md), [prices](/guides/prices.md), [limits](/guides/limits.md).
