diff --git a/prepayment.go b/prepayment.go index 2b9cf4d1..21f11b8c 100644 --- a/prepayment.go +++ b/prepayment.go @@ -38,6 +38,9 @@ type PrepaymentStatus struct { Blocked bool `json:"blocked"` Eligible bool `json:"eligible"` MonthToDateBalance string `json:"month_to_date_balance"` + // AvailableCredit is the credit available for Inference & Agents: inference, + // trial, and available subscription credit. Empty when the token lacks billing read access. + AvailableCredit string `json:"available_credit,omitempty"` } // PrepaymentConfigResponse is the response from the public prepayment config endpoint. diff --git a/prepayment_test.go b/prepayment_test.go index 8fc3e914..1812456d 100644 --- a/prepayment_test.go +++ b/prepayment_test.go @@ -30,7 +30,8 @@ func TestPrepaymentGetConfig(t *testing.T) { "is_auto_prepay_enabled": true, "blocked": true, "eligible": true, - "month_to_date_balance": "75.00" + "month_to_date_balance": "75.00", + "available_credit": "9.29" } } ` @@ -58,6 +59,7 @@ func TestPrepaymentGetConfig(t *testing.T) { Blocked: true, Eligible: true, MonthToDateBalance: "75.00", + AvailableCredit: "9.29", }, } if !reflect.DeepEqual(got, expected) { @@ -79,7 +81,8 @@ func TestPrepaymentGetStatus(t *testing.T) { "is_auto_prepay_enabled": true, "blocked": true, "eligible": true, - "month_to_date_balance": "75.00" + "month_to_date_balance": "75.00", + "available_credit": "9.29" } } ` @@ -99,6 +102,7 @@ func TestPrepaymentGetStatus(t *testing.T) { Blocked: true, Eligible: true, MonthToDateBalance: "75.00", + AvailableCredit: "9.29", }, } if !reflect.DeepEqual(got, expected) {