Dyno Phi
ContentsPython SDKShow

phi.billing

Read credits and manage payments and auto-reload.

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

NameType
enabledrequiredbool
threshold_creditsrequiredint
amount_centsrequiredint
monthly_cap_centsrequiredint
AutoReload fields and schemaShow

Fields

NameTypeDefault
amount_centsrequiredinteger
disabled_reasonoptionalstring or nullnull
enabledrequiredboolean
monthly_cap_centsrequiredinteger
this_month_centsoptionalinteger0
threshold_creditsrequiredinteger
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 schemaShow

Fields

NameTypeDefault
auto_reloadrequiredobject
balancerequiredobject
credit_price_centsrequiredinteger
organization_idrequiredstring
packsoptional(object)[]
payment_methodoptionalobject or nullnull
payment_method_savedoptionalbooleanfalse
planrequiredstring
portal_availableoptionalbooleanfalse
presetsoptional(object)[]
providerrequiredstring
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

NameTypeDefault
amount_centsoptionalint | NoneNone
packoptionalstr | NoneNone
LoadStart fields and schemaShow

Fields

NameType
loadrequiredobject
urlrequiredstring
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

NameTypeDefault
limitoptionalint20
Load fields and schemaShow

Fields

NameTypeDefaultDescription
amount_centsrequiredinteger
created_atrequiredstringformat: date-time
creditsrequiredinteger
erroroptionalstring or nullnull
idrequiredstring
kindrequired"load" | "auto"
provider_refoptionalstring or nullnull
settled_atoptionalstring or nullnull
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.