> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackshift.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Credits API

> Shared monthly allocation, usage, explicit top-ups and funding preferences for the signed-in billing owner.

Shared monthly allocation, usage, explicit top-ups and funding preferences for the signed-in billing owner. Base URL: `https://api.stackshift.cloud/api/v1`

Authentication: `bearer`. SDK-backed operations are traced to official source files in the coverage report. Routes without an SDK wrapper are explicitly marked contract-only.

| Method | SDK route | SDK method | Request type | Response type |
| - | - | - | - | - |
| `GET` | `/billing/ai-credits` | `AICreditsClient.balance` | `None` | `AICreditBalance` |
| `GET` | `/billing/ai-credits/usage` | `AICreditsClient.usage` | `AICreditUsageFilters` | `AICreditUsagePage` |
| `POST` | `/billing/ai-credits/top-ups/quote` | `AICreditsClient.quote` | `{ credits: number; currency: "NGN" \| "USD" }` | `AICreditQuote` |
| `POST` | `/billing/ai-credits/top-ups/checkout` | `AICreditsClient.checkout` | `{ quote_id: string; idempotency_key: string; provider: string; }` | `AICreditCheckout` |
| `GET` | `/billing/ai-credits/funding` | `AICreditsClient.funding` | `None` | `AIFundingPreferences` |
| `PUT` | `/billing/ai-credits/funding` | `AICreditsClient.setFunding` | `{ product: "assets" \| "agents" \| "workflows"; mode: "managed" \| "byok" }` | `AIFundingPreferences` |

## Error envelope

Non-2xx responses use the StackShift response envelope. Check `success: false`, then read the structured `error` value and HTTP status. SDK clients surface the status, code, message, and details through their native error type.

## Examples

These static examples show the verified route and authentication boundary. Use the official SDK method shown in each heading so serialization and response unwrapping remain consistent with the contract.

### `GET /billing/ai-credits`

```bash theme={null}
curl -X GET "https://api.stackshift.cloud/api/v1/billing/ai-credits"   -H "Authorization: Bearer $STACKSHIFT_API_KEY"
```

The SDK serializes any supported query options for this operation.

Response:

```json theme={null}
{
  "success": true,
  "data": "example"
}
```

### `POST /billing/ai-credits/top-ups/quote`

```bash theme={null}
curl -X POST "https://api.stackshift.cloud/api/v1/billing/ai-credits/top-ups/quote"   -H "Authorization: Bearer $STACKSHIFT_API_KEY"   -H "Content-Type: application/json"   --data '{"credits":1,"currency":"USD"}'
```

The request body is derived from `{ credits: number; currency: "NGN" | "USD" }` in the official SDK contract.

Response:

```json theme={null}
{
  "success": true,
  "data": "example"
}
```


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