Skip to content
Start here

Topup

Create a top-up
ai_gateway.billing.topup.create(TopupCreateParams**kwargs) -> TopupCreateResponse
POST/accounts/{account_id}/ai-gateway/billing/topup
Check top-up status
ai_gateway.billing.topup.status(TopupStatusParams**kwargs) -> TopupStatusResponse
POST/accounts/{account_id}/ai-gateway/billing/topup/status
ModelsExpand Collapse
class TopupCreateResponse:
client_secret: Optional[str]

Stripe PaymentIntent client secret.

onboarding: bool

Whether the user was already onboarded.

payment_intent_id: str

Stripe invoice ID.

brand: Optional[str]

Card brand (visa, mastercard, etc.).

last4: Optional[str]

Last 4 digits of card.

class TopupStatusResponse:
payment_intent_id: str
status: Literal["completed", "pending"]
One of the following:
"completed"
"pending"

TopupConfig

Get auto top-up configuration
ai_gateway.billing.topup.config.get(ConfigGetParams**kwargs) -> ConfigGetResponse
GET/accounts/{account_id}/ai-gateway/billing/topup/config
Set auto top-up configuration
ai_gateway.billing.topup.config.create(ConfigCreateParams**kwargs) -> ConfigCreateResponse
POST/accounts/{account_id}/ai-gateway/billing/topup/config
Delete auto top-up configuration
ai_gateway.billing.topup.config.delete(ConfigDeleteParams**kwargs) -> object
DELETE/accounts/{account_id}/ai-gateway/billing/topup/config
ModelsExpand Collapse
class ConfigGetResponse:
amount: Optional[float]
disabled_reason: Optional[str]
error: Optional[str]
last_failed_at: Optional[float]
threshold: Optional[float]
class ConfigCreateResponse:
amount: float
threshold: float