Authentication
Two paths. Same API. Choose what fits your use case.
nightglass supports two authentication methods, and they're not mutually exclusive — the same endpoint handles both.
Path 1: API key (developers)
The traditional path. Sign up, get a key, pass it in the Authorization header.
Authorization: Bearer ng_live_abc123...
Your account has a prepaid balance (in millicents). Each screenshot deducts from the balance. Top up via Stripe on the dashboard.
| Feature | Detail |
|---|---|
| Header | Authorization: Bearer YOUR_KEY |
| Billing | Prepaid balance, top up via Stripe |
| Price | $0.005 per screenshot (0.5¢) |
| Free tier | 50 screenshots on signup |
| Dashboard | api.nightglass.xyz/dashboard |
Path 2: x402 (AI agents)
The agent-native path. No signup. No API key. No account. Just money and a URL.
When you call the screenshot endpoint without an Authorization header, you get back a 402 Payment Required response containing x402 payment details:
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"x402": {
"version": 1,
"schemes": [{
"scheme": "exact",
"network": "base",
"token": "USDC",
"maxAmountRequired": "5000",
"resource": "https://api.nightglass.xyz/api/v1/screenshot",
"payTo": "0x1C68...3bC"
}]
}
}
Your agent reads this, signs a USDC payment on Base, attaches the payment proof as an X-PAYMENT header, and re-sends the request. The screenshot comes back.
| Feature | Detail |
|---|---|
| Protocol | x402 (HTTP 402 native) |
| Token | USDC on Base |
| Signup required | None |
| API key needed | No |
| Price | $0.005 per screenshot (0.5¢) |
Why two paths? Human developers want dashboards, usage history, and Stripe billing. AI agents want to pay and go. nightglass serves both from the same endpoint — the presence or absence of an API key determines the payment path.