allmodels.ioDocs
API ReferenceAccount

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.

POST/account/top-up-link

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.

Authorization

BearerAuth
AuthorizationBearer <token>

Tenant key supplied as the Authorization Bearer token.

In: header

Header Parameters

idempotency-key?string

Optional identifier for safely retrying a request after a timeout or network error. Reuse the same value only when amount_usd is unchanged.

Length1 <= length <= 255

Request 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

Client
Language
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());
{  "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"}