---
title: Billing
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[AI Gateway](https://developers.cloudflare.com/api/python/resources/ai_gateway)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Billing

##### [Get credit balance](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/methods/credit_balance)

ai\_gateway.billing.credit\_balance(BillingCreditBalanceParams\*\*kwargs) -> [BillingCreditBalanceResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/ai-gateway/billing/credit-balance

##### [Get usage history](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/methods/usage_history)

ai\_gateway.billing.usage\_history(BillingUsageHistoryParams\*\*kwargs) -> [BillingUsageHistoryResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_usage_history_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/ai-gateway/billing/usage-history

##### [Get invoice history](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/methods/invoice_history)

ai\_gateway.billing.invoice\_history(BillingInvoiceHistoryParams\*\*kwargs) -> [BillingInvoiceHistoryResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/ai-gateway/billing/invoice-history

##### [Get invoice preview](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/methods/invoice_preview)

ai\_gateway.billing.invoice\_preview(BillingInvoicePreviewParams\*\*kwargs) -> [BillingInvoicePreviewResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/ai-gateway/billing/invoice-preview

##### ModelsExpand Collapse

<details>

<summary>

class BillingCreditBalanceResponse: …

</summary>

balance: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20balance">Link to this property</a>

has\_default\_payment\_method: bool

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20has_default_payment_method">Link to this property</a>

<details>

<summary>

payment\_method: Optional\[PaymentMethod]

</summary>

brand: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20payment_method%20%3E%20(property)%20brand">Link to this property</a>

last4: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20payment_method%20%3E%20(property)%20last4">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20payment_method">Link to this property</a>

<details>

<summary>

topup\_config: TopupConfig

</summary>

amount: Optional\[float]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20topup_config%20%3E%20(property)%20amount">Link to this property</a>

threshold: Optional\[float]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20topup_config%20%3E%20(property)%20threshold">Link to this property</a>

disabled\_reason: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20topup_config%20%3E%20(property)%20disabledReason">Link to this property</a>

error: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20topup_config%20%3E%20(property)%20error">Link to this property</a>

last\_failed\_at: Optional\[float]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20topup_config%20%3E%20(property)%20lastFailedAt">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20topup_config">Link to this property</a>

first\_topup\_success: Optional\[bool]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)%20%3E%20(property)%20first_topup_success">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_credit_balance_response%20%3E%20(schema)>)

<details>

<summary>

class BillingUsageHistoryResponse: …

</summary>

<details>

<summary>

history: List\[History]

</summary>

id: str

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_usage_history_response%20%3E%20(schema)%20%3E%20(property)%20history%20%3E%20(items)%20%3E%20(property)%20id">Link to this property</a>

aggregated\_value: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_usage_history_response%20%3E%20(schema)%20%3E%20(property)%20history%20%3E%20(items)%20%3E%20(property)%20aggregated_value">Link to this property</a>

end\_time: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_usage_history_response%20%3E%20(schema)%20%3E%20(property)%20history%20%3E%20(items)%20%3E%20(property)%20end_time">Link to this property</a>

start\_time: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_usage_history_response%20%3E%20(schema)%20%3E%20(property)%20history%20%3E%20(items)%20%3E%20(property)%20start_time">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_usage_history_response%20%3E%20(schema)%20%3E%20(property)%20history">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_usage_history_response%20%3E%20(schema)>)

<details>

<summary>

class BillingInvoiceHistoryResponse: …

</summary>

<details>

<summary>

invoices: List\[Invoice]

</summary>

amount\_due: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20amount_due">Link to this property</a>

amount\_paid: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20amount_paid">Link to this property</a>

amount\_remaining: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20amount_remaining">Link to this property</a>

currency: str

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20currency">Link to this property</a>

id: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20id">Link to this property</a>

attempt\_count: Optional\[float]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20attempt_count">Link to this property</a>

attempted: Optional\[bool]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20attempted">Link to this property</a>

auto\_advance: Optional\[bool]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20auto_advance">Link to this property</a>

created: Optional\[float]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20created">Link to this property</a>

created\_by: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20created_by">Link to this property</a>

description: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20description">Link to this property</a>

invoice\_origin: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20invoice_origin">Link to this property</a>

invoice\_pdf: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20invoice_pdf">Link to this property</a>

status: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices%20%3E%20(items)%20%3E%20(property)%20status">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20invoices">Link to this property</a>

<details>

<summary>

pagination: Pagination

</summary>

has\_more: bool

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20pagination%20%3E%20(property)%20has_more">Link to this property</a>

page: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20pagination%20%3E%20(property)%20page">Link to this property</a>

per\_page: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20pagination%20%3E%20(property)%20per_page">Link to this property</a>

total\_count: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20pagination%20%3E%20(property)%20total_count">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)%20%3E%20(property)%20pagination">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_history_response%20%3E%20(schema)>)

<details>

<summary>

class BillingInvoicePreviewResponse: …

</summary>

id: str

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

amount\_due: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20amount_due">Link to this property</a>

amount\_paid: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20amount_paid">Link to this property</a>

amount\_remaining: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20amount_remaining">Link to this property</a>

currency: str

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20currency">Link to this property</a>

<details>

<summary>

invoice\_lines: List\[InvoiceLine]

</summary>

amount: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20amount">Link to this property</a>

currency: str

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20currency">Link to this property</a>

description: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20description">Link to this property</a>

<details>

<summary>

period: InvoiceLinePeriod

</summary>

end: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20period%20%3E%20(property)%20end">Link to this property</a>

start: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20period%20%3E%20(property)%20start">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20period">Link to this property</a>

<details>

<summary>

pricing: InvoiceLinePricing

</summary>

unit\_amount\_decimal: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20pricing%20%3E%20(property)%20unit_amount_decimal">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20pricing">Link to this property</a>

quantity: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20quantity">Link to this property</a>

<details>

<summary>

pretax\_credit\_amounts: Optional\[List\[InvoiceLinePretaxCreditAmount]]

</summary>

amount: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20pretax_credit_amounts%20%3E%20(items)%20%3E%20(property)%20amount">Link to this property</a>

type: str

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20pretax_credit_amounts%20%3E%20(items)%20%3E%20(property)%20type">Link to this property</a>

credit\_balance\_transaction: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20pretax_credit_amounts%20%3E%20(items)%20%3E%20(property)%20credit_balance_transaction">Link to this property</a>

discount: Optional\[str]

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20pretax_credit_amounts%20%3E%20(items)%20%3E%20(property)%20discount">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines%20%3E%20(items)%20%3E%20(property)%20pretax_credit_amounts">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20invoice_lines">Link to this property</a>

period\_end: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20period_end">Link to this property</a>

period\_start: float

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20period_start">Link to this property</a>

<details>

<summary>

status: Literal\["draft", "open", "paid", 2 more]

</summary>

One of the following:

"draft"

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"open"

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

"paid"

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%202">Link to this property</a>

"uncollectible"

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%203">Link to this property</a>

"void"

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing%20%3E%20(model)%20billing_invoice_preview_response%20%3E%20(schema)>)

#### BillingTopup

##### [Create a top-up](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/topup/methods/create)

ai\_gateway.billing.topup.create(TopupCreateParams\*\*kwargs) -> [TopupCreateResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_create_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/ai-gateway/billing/topup

##### [Check top-up status](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/topup/methods/status)

ai\_gateway.billing.topup.status(TopupStatusParams\*\*kwargs) -> [TopupStatusResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_status_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/ai-gateway/billing/topup/status

##### ModelsExpand Collapse

<details>

<summary>

class TopupCreateResponse: …

</summary>

client\_secret: Optional\[str]

Stripe PaymentIntent client secret.

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_create_response%20%3E%20(schema)%20%3E%20(property)%20client_secret">Link to this property</a>

onboarding: bool

Whether the user was already onboarded.

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_create_response%20%3E%20(schema)%20%3E%20(property)%20onboarding">Link to this property</a>

payment\_intent\_id: str

Stripe invoice ID.

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_create_response%20%3E%20(schema)%20%3E%20(property)%20payment_intent_id">Link to this property</a>

brand: Optional\[str]

Card brand (visa, mastercard, etc.).

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_create_response%20%3E%20(schema)%20%3E%20(property)%20brand">Link to this property</a>

last4: Optional\[str]

Last 4 digits of card.

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_create_response%20%3E%20(schema)%20%3E%20(property)%20last4">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_create_response%20%3E%20(schema)>)

<details>

<summary>

class TopupStatusResponse: …

</summary>

payment\_intent\_id: str

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_status_response%20%3E%20(schema)%20%3E%20(property)%20payment_intent_id">Link to this property</a>

<details>

<summary>

status: Literal\["completed", "pending"]

</summary>

One of the following:

"completed"

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_status_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"pending"

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_status_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_status_response%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing.topup%20%3E%20(model)%20topup_status_response%20%3E%20(schema)>)

#### BillingTopupConfig

##### [Get auto top-up configuration](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/topup/subresources/config/methods/get)

ai\_gateway.billing.topup.config.get(ConfigGetParams\*\*kwargs) -> [ConfigGetResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_get_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/ai-gateway/billing/topup/config

##### [Set auto top-up configuration](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/topup/subresources/config/methods/create)

ai\_gateway.billing.topup.config.create(ConfigCreateParams\*\*kwargs) -> [ConfigCreateResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_create_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/ai-gateway/billing/topup/config

##### [Delete auto top-up configuration](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/topup/subresources/config/methods/delete)

ai\_gateway.billing.topup.config.delete(ConfigDeleteParams\*\*kwargs) -> object

DELETE/accounts/{account\_id}/ai-gateway/billing/topup/config

##### ModelsExpand Collapse

<details>

<summary>

class ConfigGetResponse: …

</summary>

amount: Optional\[float]

<a href="#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_get_response%20%3E%20(schema)%20%3E%20(property)%20amount">Link to this property</a>

threshold: Optional\[float]

<a href="#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_get_response%20%3E%20(schema)%20%3E%20(property)%20threshold">Link to this property</a>

disabled\_reason: Optional\[str]

<a href="#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_get_response%20%3E%20(schema)%20%3E%20(property)%20disabledReason">Link to this property</a>

error: Optional\[str]

<a href="#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_get_response%20%3E%20(schema)%20%3E%20(property)%20error">Link to this property</a>

last\_failed\_at: Optional\[float]

<a href="#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_get_response%20%3E%20(schema)%20%3E%20(property)%20lastFailedAt">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_get_response%20%3E%20(schema)>)

<details>

<summary>

class ConfigCreateResponse: …

</summary>

amount: float

<a href="#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_create_response%20%3E%20(schema)%20%3E%20(property)%20amount">Link to this property</a>

threshold: float

<a href="#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_create_response%20%3E%20(schema)%20%3E%20(property)%20threshold">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing.topup.config%20%3E%20(model)%20config_create_response%20%3E%20(schema)>)

#### BillingSpending Limit

##### [Get spending limit (deprecated)](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/spending_limit/methods/get)

ai\_gateway.billing.spending\_limit.get(SpendingLimitGetParams\*\*kwargs) -> [SpendingLimitGetResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.billing.spending_limit%20%3E%20(model)%20spending_limit_get_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/ai-gateway/billing/spending-limit

##### [Set spending limit (deprecated)](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/spending_limit/methods/create)

Deprecated

ai\_gateway.billing.spending\_limit.create(SpendingLimitCreateParams\*\*kwargs) -> object

POST/accounts/{account\_id}/ai-gateway/billing/spending-limit

##### [Delete spending limit (deprecated)](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/billing/subresources/spending_limit/methods/delete)

ai\_gateway.billing.spending\_limit.delete(SpendingLimitDeleteParams\*\*kwargs) -> object

DELETE/accounts/{account\_id}/ai-gateway/billing/spending-limit

##### ModelsExpand Collapse

<details>

<summary>

class SpendingLimitGetResponse: …

</summary>

<details>

<summary>

config: Config

</summary>

amount: Optional\[float]

<a href="#(resource)%20ai_gateway.billing.spending_limit%20%3E%20(model)%20spending_limit_get_response%20%3E%20(schema)%20%3E%20(property)%20config%20%3E%20(property)%20amount">Link to this property</a>

duration: Optional\[str]

<a href="#(resource)%20ai_gateway.billing.spending_limit%20%3E%20(model)%20spending_limit_get_response%20%3E%20(schema)%20%3E%20(property)%20config%20%3E%20(property)%20duration">Link to this property</a>

strategy: Optional\[str]

<a href="#(resource)%20ai_gateway.billing.spending_limit%20%3E%20(model)%20spending_limit_get_response%20%3E%20(schema)%20%3E%20(property)%20config%20%3E%20(property)%20strategy">Link to this property</a>

</details>

<a href="#(resource)%20ai_gateway.billing.spending_limit%20%3E%20(model)%20spending_limit_get_response%20%3E%20(schema)%20%3E%20(property)%20config">Link to this property</a>

enabled: bool

<a href="#(resource)%20ai_gateway.billing.spending_limit%20%3E%20(model)%20spending_limit_get_response%20%3E%20(schema)%20%3E%20(property)%20enabled">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.billing.spending_limit%20%3E%20(model)%20spending_limit_get_response%20%3E%20(schema)>)