mirror of
https://github.com/cunnymessiah/keychecker.git
synced 2026-05-10 18:39:04 -07:00
bug fixes
This commit is contained in:
@@ -55,16 +55,18 @@ async def get_oai_key_tier(key: APIKey, session):
|
||||
if key.trial:
|
||||
return 'Free'
|
||||
tts_object = {"model": "tts-1-hd", "input": "", "voice": "alloy"}
|
||||
async with session.post(f'{oai_api_url}/audio/speech',
|
||||
headers={'Authorization': f'Bearer {key.api_key}', 'accept': 'application/json'},
|
||||
json=tts_object) as response:
|
||||
if response.status in [400, 429]:
|
||||
try:
|
||||
return oai_tiers[int(response.headers.get("x-ratelimit-limit-requests"))]
|
||||
except KeyError:
|
||||
for _ in range(3): # we'll give it 3 shots if oai decides to shid itself.
|
||||
async with session.post(f'{oai_api_url}/audio/speech',
|
||||
headers={'Authorization': f'Bearer {key.api_key}', 'accept': 'application/json'},
|
||||
json=tts_object) as response:
|
||||
if response.status in [400, 429]:
|
||||
try:
|
||||
return oai_tiers[int(response.headers.get("x-ratelimit-limit-requests"))]
|
||||
except (KeyError, TypeError, ValueError):
|
||||
continue
|
||||
else:
|
||||
return
|
||||
else:
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
async def get_oai_org(key: APIKey, session):
|
||||
|
||||
@@ -93,7 +93,7 @@ async def validate_makersuite(key: APIKey, sem):
|
||||
api_keys.add(key)
|
||||
|
||||
|
||||
async def validate_aws(key: APIKey):
|
||||
def validate_aws(key: APIKey):
|
||||
if check_aws(key) is None:
|
||||
return
|
||||
api_keys.add(key)
|
||||
@@ -106,7 +106,7 @@ async def validate_azure(key: APIKey, sem):
|
||||
api_keys.add(key)
|
||||
|
||||
|
||||
async def validate_vertexai(key: APIKey):
|
||||
def validate_vertexai(key: APIKey):
|
||||
if check_vertexai(key) is None:
|
||||
return
|
||||
api_keys.add(key)
|
||||
|
||||
Reference in New Issue
Block a user