MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / updateChannelAIGC2DBalance

Function updateChannelAIGC2DBalance

controller/channel-billing.go:281–294  ·  view source on GitHub ↗
(channel *model.Channel)

Source from the content-addressed store, hash-verified

279}
280
281func updateChannelAIGC2DBalance(channel *model.Channel) (float64, error) {
282 url := "https://api.aigc2d.com/dashboard/billing/credit_grants"
283 body, err := GetResponseBody("GET", url, channel, GetAuthHeader(channel.Key))
284 if err != nil {
285 return 0, err
286 }
287 response := APGC2DGPTUsageResponse{}
288 err = json.Unmarshal(body, &response)
289 if err != nil {
290 return 0, err
291 }
292 channel.UpdateBalance(response.TotalAvailable)
293 return response.TotalAvailable, nil
294}
295
296func updateChannelOpenRouterBalance(channel *model.Channel) (float64, error) {
297 url := "https://openrouter.ai/api/v1/credits"

Callers 1

updateChannelBalanceFunction · 0.85

Calls 3

GetResponseBodyFunction · 0.85
GetAuthHeaderFunction · 0.85
UpdateBalanceMethod · 0.80

Tested by

no test coverage detected