# Crane Ledger Pricing

Headless accounting API with transparent, credit-based pricing. Reads are free. Writes cost at most $0.01.

**1 credit = $0.01 USD.** New master organizations receive **500 free credits**.

## Credit Packages

| Package | Credits | Price | Notes |
| ------- | ------- | ----- | ----- |
| Solo Dev | 1,000 | $10 | Individual developers |
| Builder | 5,000 | $50 | Development teams |
| Scale | 25,000 | $250 | High-volume platforms |
| Custom | — | Contact | Volume discounts available |

Any credit amount can be purchased (API minimum applies). Packages above are common presets.

## What Operations Cost

| Category | Credits | Cost |
| -------- | ------- | ---- |
| Read operations (GET, lists, searches, reports) | 0 | Free |
| Write operations (create, update, post, reverse, send, pay) | ≤ 1 | ≤ $0.01 |
| Document uploads | 1 | $0.01 |
| Organization base cost | 25 / week | $1 / month per org (prorated daily) |

Credits live on the **master (billing root) organization**. Sub-organizations share that pool.

### Auto-recharge

When enabled on a master org: if balance drops below **400 credits** ($4), Stripe auto-recharges up to **2,000 credits** ($20).

## Payment Methods

| Method | Asset | Who it's for |
| ------ | ----- | ------------ |
| **Stripe Checkout** | Card, Link, Apple Pay / Google Pay (where enabled) | Humans and flows that can open a browser checkout URL |
| **x402** | USDC on Base (`eip155:8453`) | Agents and programmatic wallets |

x402 accepted asset: official USDC on Base at `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`.

---

## For Agents: Register, Authenticate, and Load Credits

Use either Stripe or x402 — whichever your runtime prefers.

### 1. Register / create a master account

**Human (GitHub):** sign up at https://craneledger.ai — creates a user and master org with **500 credits**.

**REST API:**

```http
POST https://api.craneledger.ai/users
Content-Type: application/json

{
  "github_id": "12345678",
  "username": "agent-owner",
  "email": "owner@example.com"
}
```

```http
POST https://api.craneledger.ai/accounts/master
Content-Type: application/json

{
  "name": "My Business LLC",
  "user_github_id": "12345678",
  "user_email": "owner@example.com",
  "base_currency_code": "USD"
}
```

Response includes the master `organization_id` and Stripe customer setup. You receive **500 credits**.

**MCP:** call `create_master_account` against `https://api.craneledger.ai/mcp` (same provisioning as `POST /accounts/master`).

### 2. Authenticate

- **API key:** `Authorization: Bearer ha_live_…` or `ha_test_…` (create/rotate via dashboard or API).
- **OAuth 2.1 (MCP connectors):**  
  - Resource metadata: `GET https://api.craneledger.ai/.well-known/oauth-protected-resource`  
  - Auth server: `https://auth.craneledger.ai`  
  - MCP endpoint: `https://api.craneledger.ai/mcp`  
  - Scopes: `ledger:read`, `ledger:write`, `ledger:admin`

Always use the **billing master** organization id for credit purchases, even if the key is scoped to a sub-org.

### 3a. Load credits with Stripe

```http
POST https://api.craneledger.ai/organizations/{master_organization_id}/credits/purchase
Authorization: Bearer ha_live_...
Content-Type: application/json

{
  "organization_id": "{master_organization_id}",
  "credit_amount": 1000,
  "success_url": "https://yourapp.com/billing/success",
  "cancel_url": "https://yourapp.com/billing/cancel"
}
```

Open the returned `checkout_url` in a browser (or return it to a human). Credits are added after Stripe webhook confirmation.

**MCP:** `get_credit_packages` then `purchase_credits` (returns a checkout URL).

**Web app:** signed-in users can use Dashboard → Billing (`POST https://craneledger.ai/api/stripe/checkout`, minimum 100 credits).

### 3b. Load credits with x402 (USDC on Base)

```http
POST https://api.craneledger.ai/organizations/{master_organization_id}/credits/purchase-x402?credits=1000
Authorization: Bearer ha_live_...
```

1. First request **without** a payment signature → **402 Payment Required** with `PAYMENT-REQUIRED` (base64 x402 v2 challenge).
2. Sign / settle with an x402-aware client (e.g. `@x402/fetch` or `@x402/axios`).
3. Retry the same URL with `PAYMENT-SIGNATURE: {base64 payload}` → **200** and credits added.

**1 credit = $0.01 USDC** (USDC has 6 decimals → atomic amount = `credits × 10_000`).

**MCP:** `start_x402_credit_purchase` (expect 402 + `PAYMENT-REQUIRED` in headers) then `complete_x402_credit_purchase` with `payment_signature_b64`.

### 4. Check balance

```http
GET https://api.craneledger.ai/organizations/{organization_id}/credits/balance
Authorization: Bearer ha_live_...
```

Or `GET /organizations/{organization_id}/billing`. MCP: `get_credit_balance`.

List packages anytime: `GET https://api.craneledger.ai/credits/packages`.

---

## Links

- https://craneledger.ai/pricing.md
- https://craneledger.ai/docs/getting-started/pricing
- https://craneledger.ai/docs/getting-started/billing
- https://craneledger.ai/docs/api-reference/x402-credits
- https://craneledger.ai/llms.txt
- https://craneledger.ai (sign up)
- https://api.craneledger.ai/mcp
