fix(ccswitch): parse remaining quota from /v1/usage response
This commit is contained in:
@@ -1638,10 +1638,12 @@ const executeCcsImport = (row: ApiKey, clientType: 'claude' | 'gemini') => {
|
|||||||
headers: { "Authorization": "Bearer {{apiKey}}" }
|
headers: { "Authorization": "Bearer {{apiKey}}" }
|
||||||
},
|
},
|
||||||
extractor: function(response) {
|
extractor: function(response) {
|
||||||
|
const remaining = response?.remaining ?? response?.quota?.remaining ?? response?.balance;
|
||||||
|
const unit = response?.unit ?? response?.quota?.unit ?? "USD";
|
||||||
return {
|
return {
|
||||||
isValid: response.is_active || true,
|
isValid: response?.is_active ?? response?.isValid ?? true,
|
||||||
remaining: response.balance,
|
remaining,
|
||||||
unit: "USD"
|
unit
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})`
|
})`
|
||||||
|
|||||||
Reference in New Issue
Block a user