Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions prepayment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions prepayment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
`
Expand Down Expand Up @@ -58,6 +59,7 @@ func TestPrepaymentGetConfig(t *testing.T) {
Blocked: true,
Eligible: true,
MonthToDateBalance: "75.00",
AvailableCredit: "9.29",
},
}
if !reflect.DeepEqual(got, expected) {
Expand All @@ -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"
}
}
`
Expand All @@ -99,6 +102,7 @@ func TestPrepaymentGetStatus(t *testing.T) {
Blocked: true,
Eligible: true,
MonthToDateBalance: "75.00",
AvailableCredit: "9.29",
},
}
if !reflect.DeepEqual(got, expected) {
Expand Down
Loading