Commit
·
d667fd9
1
Parent(s):
4f19aff
Update api_usage.py
Browse files- api_usage.py +3 -3
api_usage.py
CHANGED
@@ -98,9 +98,9 @@ def format_status(list_models_avai, headers):
|
|
98 |
if "error" in result:
|
99 |
e = result.get("error", {}).get("code", "")
|
100 |
if e == None:
|
101 |
-
rpm_num = int(
|
102 |
-
tpm_num = int(
|
103 |
-
tpm_left = int(
|
104 |
_rpm = '{:,}'.format(rpm_num).replace(',', ' ')
|
105 |
_tpm = '{:,}'.format(tpm_num).replace(',', ' ')
|
106 |
_tpm_left = '{:,}'.format(tpm_left).replace(',', ' ')
|
|
|
98 |
if "error" in result:
|
99 |
e = result.get("error", {}).get("code", "")
|
100 |
if e == None:
|
101 |
+
rpm_num = int(r.headers.get("x-ratelimit-limit-requests", 0))
|
102 |
+
tpm_num = int(r.headers.get('x-ratelimit-limit-tokens', 0))
|
103 |
+
tpm_left = int(r.headers.get('x-ratelimit-remaining-tokens', 0))
|
104 |
_rpm = '{:,}'.format(rpm_num).replace(',', ' ')
|
105 |
_tpm = '{:,}'.format(tpm_num).replace(',', ' ')
|
106 |
_tpm_left = '{:,}'.format(tpm_left).replace(',', ' ')
|