Create a link to add account balance
Create a secure payment link for adding prepaid balance to the account associated with your API key. Authenticate with `Authorization: Bearer <apiKey>` and provide the amount in `amount_usd`. Open the returned `url` in a browser or send it to the person who manages account funding. After payment succeeds, the account balance updates automatically.
/account/top-up-linkCreate a secure payment link for adding prepaid balance to the account associated with your API key. Authenticate with Authorization: Bearer <apiKey> and provide the amount in amount_usd. Open the returned url in a browser or send it to the person who manages account funding. After payment succeeds, the account balance updates automatically.
Authorization
BearerAuth Tenant key supplied as the Authorization Bearer token.
In: header
Header Parameters
Optional identifier for safely retrying a request after a timeout or network error. Reuse the same value only when amount_usd is unchanged.
1 <= length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
import { writeFile } from "node:fs/promises";const response = await fetch("https://api.allmodels.io/account/top-up-link", { method: "POST", headers: { ...{ Authorization: `Bearer ${process.env.ALLMODELS_API_KEY}` }, "Content-Type": "application/json" }, body: JSON.stringify({ "amount_usd": 50})});if (!response.ok) throw new Error(`AllModels request failed: ${response.status}`);console.log(await response.json());import osimport requestspayload = { "amount_usd": 50}response = requests.post( "https://api.allmodels.io/account/top-up-link", headers={"Authorization": f"Bearer {os.environ['ALLMODELS_API_KEY']}"}, json=payload, timeout=60,)response.raise_for_status()print(response.json())curl -X POST https://api.allmodels.io/account/top-up-link \ -H "Authorization: Bearer $ALLMODELS_API_KEY" \ -H "Content-Type: application/json" \ --data '{ "amount_usd": 50}'{ "url": "https://checkout.stripe.com/c/pay/cs_test_example", "amount_usd": 50, "expires_at": "2026-07-22T12:00:00.000Z"}{ "error": "invalid_request"}{ "error": "invalid_request"}{ "error": "invalid_request"}{ "error": "invalid_request"}{ "error": "invalid_request"}{ "error": "invalid_request"}{ "error": "invalid_request"}Verify the code and receive an API key POST
Complete email-based account access by submitting the same email address and the six-digit code from the verification email. A successful response contains an AllModels API key. Save it securely when received because the full key is returned only in this response. Use it as `Authorization: Bearer <apiKey>` for authenticated API requests. If the code cannot be verified, start the flow again to request a new one.
Check account balance GET
Use this endpoint to check the paid and promotional credits associated with your API key. Authenticate with `Authorization: Bearer <apiKey>`. Use `spendable_paid_credits` to see the paid balance available for any request. Promotional credits can be limited to the provider and model combinations in `promotion_grants.targets`, so check each grant's `eligible` and `expires_at` values before relying on it. A `state` of `exhausted` means no balance is currently available for requests. One credit equals $0.000001. You can call this endpoint even when the balance is zero.
