# carbium services: notes for AI agents

carbium serves Solana mainnet to developers behind one API key: JSON-RPC, WebSocket subscriptions, the carbon stream (Yellowstone gRPC) and a quote API that returns route quotes and unsigned transactions for your own wallet to sign.

## Start here

- [skill.md](https://carbium.sh/skill.md): the whole API as one markdown skill: endpoints, auth, every limit, every error with the action to take, and complete clients. Read it before you write code.
- [llms.txt](https://carbium.sh/llms.txt): the short index.
- [openapi.json](https://carbium.sh/openapi.json): the account API.
- [pricing.md](https://carbium.sh/pricing.md): plans, prices and limits as a table; the same prices as JSON at [/v1/plans](https://carbium.sh/v1/plans).

## Endpoints

| Plane | Endpoint | Credential |
|---|---|---|
| RPC and quote (`quote`, `swap`, `prices`, `health`) | `https://services.carbium.sh` | header `x-api-key: <c_serv_ key>` |
| WebSocket | `wss://services.carbium.sh` | header `x-api-key`, or the subprotocol `api-key.<KEY>` in a browser |
| Carbon stream (gRPC) | `https://services.carbium.sh:9443` | metadata `x-token: <c_serv_ key>` |
| Account API | `https://carbium.sh/v1` | `Authorization: Bearer <c_acct_ key>` |

RPC and the quote API are JSON-RPC 2.0 over `POST` on `https://services.carbium.sh`. Two more paths answer there: the keyless `GET /livez`, and `GET /cq1/quote`, a quote by query string (the docs list its parameters).

## Get a key with no browser and no inbox

An agent needs only a Solana keypair. On `https://carbium.sh`: `GET /v1/signup/challenge` and solve it, `POST /v1/auth/wallet` twice (the message to sign, then the signature; send the `session_token` it answers as `Authorization: Bearer <session_token>` on the calls after it), `GET /v1/keys` and `POST /v1/keys/{key_id}/secret` for the key, and `POST /v1/modules/quote` with `{"plan": "free"}` for the quote API. The skill's section "Agents: onboard yourself with only a Solana keypair" ends in one runnable file.

## Rules that bind an agent

- The free plan is a license for one person or one agent. Do not run more than one free account, rotate accounts or keys for more capacity, or spread traffic over addresses to get around a limit. If a task needs more than the free plan allows, say so and point to a paid plan.
- Send the full raw key in a header. Keep it out of URLs, logs, commits and anything you show a person.
- Retry only what waiting can fix: a 429 after its `retry-after-ms`, a 5xx on a read, and the not-yet codes the skill lists. Never loop on any other 4xx.
- `swap` returns one unsigned transaction. The user's own wallet signs it, unchanged. Never retry `sendTransaction` blindly: check `getSignatureStatuses` and resend the same signed bytes until the block height passes `lastValidBlockHeight`.
- An account API key manages service keys, webhooks and usage. It cannot buy, upgrade or cancel anything: tell the person.

## Testing

Every call reaches Solana mainnet. A transaction you sign and send moves real funds.

- **Is it up, with no key:** `GET https://services.carbium.sh/livez` answers 204. The stream's `grpc.health.v1.Health/Check` answers `SERVING`.
- **First call with a key:** `getHealth` or `getSlot`, 1 credit each.
- **The quote API costs 0 credits.** `quote`, `swap` and `prices` count against the quote plan's rate (on the free quote plan also against the shared budget below), and `health` against the account's cached-read rate. `quote` builds nothing and moves nothing. `swap` returns an unsigned transaction: nothing happens until a wallet signs and sends it.
- **The free plan is enough for a test:** one free grant of credits, once (`GET /v1/balance` shows `granted`), 1 key, 5 cached reads a second, 3 DAS calls a second, 5 WebSocket connections and 10 subscriptions. The carbon stream and webhooks need the DEV, BUSINESS or PRO plan. `POST /v1/webhooks/{id}/test` sends one signed test delivery, billed as one event when it is delivered.
- **In tests and CI:** one account, one key held as a secret, a slow steady rate well under the plan's limit. Free callers on one network share 20 requests a second.
- **Never probe, scan or load test the service without written consent** ([Terms](https://carbium.sh/terms), 6.7). To time it, use the capped run on the [benchmark page](https://carbium.sh/benchmark.html). A free account refused for rate in most hours of a day is suspended.
- A refused call costs 0 credits and still spends rate: never loop on a 4xx. Two refusals do bill: a `getTransactionsForAddress` walk refused after it made upstream calls, and a send whose preflight failed.

## Support

Write to support@carbium.sh. Send the `x-request-id` of the answer you are asking about when it has one (the `x-subscription-id` for the carbon stream), the UTC time and the method. For a payment, send its `id` from `GET /v1/payments`, and for USDC or USDT also the transaction signature. Never send a raw API key: send its dashboard prefix (`c_serv_` plus four characters). Security reports: [security.txt](https://carbium.sh/.well-known/security.txt).
