phi.billing.auto_reload
Only an organization admin can use this.
python
phi.billing.auto_reload(enabled=enabled, threshold_credits=threshold_credits, amount_cents=amount_cents, monthly_cap_cents=monthly_cap_cents)Returns AutoReload.
Parameters
| Name | Type |
|---|---|
| enabledrequired | bool |
| threshold_creditsrequired | int |
| amount_centsrequired | int |
| monthly_cap_centsrequired | int |
AutoReload fields and schemaShowHide
Fields
| Name | Type | Default |
|---|---|---|
| amount_centsrequired | integer | |
| disabled_reasonoptional | string or null | null |
| enabledrequired | boolean | |
| monthly_cap_centsrequired | integer | |
| this_month_centsoptional | integer | 0 |
| threshold_creditsrequired | integer |
JSON schema
{
"type": "object",
"required": [
"enabled",
"threshold_credits",
"amount_cents",
"monthly_cap_cents"
],
"properties": {
"amount_cents": {
"type": "integer"
},
"disabled_reason": {
"default": null,
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"enabled": {
"type": "boolean"
},
"monthly_cap_cents": {
"type": "integer"
},
"this_month_cents": {
"type": "integer",
"default": 0
},
"threshold_credits": {
"type": "integer"
}
}
}phi.billing.get
python
phi.billing.get()Returns Billing.
Billing fields and schemaShowHide
Fields
| Name | Type | Default |
|---|---|---|
| auto_reloadrequired | object | |
| balancerequired | object | |
| credit_price_centsrequired | integer | |
| organization_idrequired | string | |
| packsoptional | (object)[] | |
| payment_methodoptional | object or null | null |
| payment_method_savedoptional | boolean | false |
| planrequired | string | |
| portal_availableoptional | boolean | false |
| presetsoptional | (object)[] | |
| providerrequired | string |
JSON schema
{
"type": "object",
"required": [
"organization_id",
"provider",
"plan",
"credit_price_cents",
"balance",
"auto_reload"
],
"properties": {
"auto_reload": {
"$ref": "#/$defs/AutoReload"
},
"balance": {
"$ref": "#/$defs/BillingBalance"
},
"credit_price_cents": {
"type": "integer"
},
"organization_id": {
"type": "string"
},
"packs": {
"type": "array",
"items": {
"$ref": "#/$defs/CreditPack"
}
},
"payment_method": {
"default": null,
"anyOf": [
{
"$ref": "#/$defs/PaymentMethod"
},
{
"type": "null"
}
]
},
"payment_method_saved": {
"type": "boolean",
"default": false
},
"plan": {
"type": "string"
},
"portal_available": {
"type": "boolean",
"default": false
},
"presets": {
"type": "array",
"items": {
"$ref": "#/$defs/LoadPreset"
}
},
"provider": {
"type": "string"
}
},
"$defs": {
"AutoReload": {
"type": "object",
"required": [
"enabled",
"threshold_credits",
"amount_cents",
"monthly_cap_cents"
],
"properties": {
"amount_cents": {
"type": "integer"
},
"disabled_reason": {
"default": null,
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"enabled": {
"type": "boolean"
},
"monthly_cap_cents": {
"type": "integer"
},
"this_month_cents": {
"type": "integer",
"default": 0
},
"threshold_credits": {
"type": "integer"
}
}
},
"BillingBalance": {
"type": "object",
"required": [
"allowance",
"allowance_available",
"purchased",
"total_available"
],
"properties": {
"allowance": {
"type": "integer"
},
"allowance_available": {
"type": "integer"
},
"purchased": {
"type": "integer"
},
"reset_at": {
"default": null,
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"total_available": {
"type": "integer"
}
}
},
"CreditPack": {
"type": "object",
"required": [
"slug",
"display_name",
"credits",
"amount_cents"
],
"properties": {
"amount_cents": {
"type": "integer"
},
"credits": {
"type": "integer"
},
"display_name": {
"type": "string"
},
"slug": {
"type": "string"
}
}
},
"PaymentMethod": {
"type": "object",
"required": [
"brand",
"last4",
"exp_month",
"exp_year"
],
"properties": {
"brand": {
"type": "string"
},
"exp_month": {
"type": "integer"
},
"exp_year": {
"type": "integer"
},
"last4": {
"type": "string"
}
}
},
"LoadPreset": {
"type": "object",
"required": [
"amount_cents",
"credits"
],
"properties": {
"amount_cents": {
"type": "integer"
},
"credits": {
"type": "integer"
}
}
}
}
}phi.billing.load
Only an organization admin can use this.
Start a load; the person pays at ``LoadStart.url`` and the credits
python
phi.billing.load()Returns LoadStart.
Parameters
| Name | Type | Default |
|---|---|---|
| amount_centsoptional | int | None | None |
| packoptional | str | None | None |
LoadStart fields and schemaShowHide
Fields
| Name | Type |
|---|---|
| loadrequired | object |
| urlrequired | string |
JSON schema
{
"type": "object",
"required": [
"url",
"load"
],
"properties": {
"load": {
"$ref": "#/$defs/Load"
},
"url": {
"type": "string"
}
},
"$defs": {
"Load": {
"type": "object",
"required": [
"id",
"kind",
"amount_cents",
"credits",
"status",
"created_at"
],
"properties": {
"amount_cents": {
"type": "integer"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"credits": {
"type": "integer"
},
"error": {
"default": null,
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"id": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"load",
"auto"
]
},
"provider_ref": {
"default": null,
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"settled_at": {
"default": null,
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"status": {
"type": "string",
"enum": [
"pending",
"charged",
"credited",
"failed"
]
}
}
}
}
}phi.billing.loads
python
phi.billing.loads()Returns list[Load].
Parameters
| Name | Type | Default |
|---|---|---|
| limitoptional | int | 20 |
Load fields and schemaShowHide
Fields
| Name | Type | Default | Description |
|---|---|---|---|
| amount_centsrequired | integer | ||
| created_atrequired | string | format: date-time | |
| creditsrequired | integer | ||
| erroroptional | string or null | null | |
| idrequired | string | ||
| kindrequired | "load" | "auto" | ||
| provider_refoptional | string or null | null | |
| settled_atoptional | string or null | null | |
| statusrequired | "pending" | "charged" | "credited" | "failed" |
JSON schema
{
"type": "object",
"required": [
"id",
"kind",
"amount_cents",
"credits",
"status",
"created_at"
],
"properties": {
"amount_cents": {
"type": "integer"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"credits": {
"type": "integer"
},
"error": {
"default": null,
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"id": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"load",
"auto"
]
},
"provider_ref": {
"default": null,
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"settled_at": {
"default": null,
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"status": {
"type": "string",
"enum": [
"pending",
"charged",
"credited",
"failed"
]
}
}
}phi.billing.portal
Only an organization admin can use this.
python
phi.billing.portal()Returns str.
From the installed client, phi 0.4.2, 2026-11-23.