superdup95 commited on
Commit
48142c9
·
verified ·
1 Parent(s): 7111c0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import gradio as gr
2
- import requests
3
  from api_usage import get_subscription, check_key_availability, check_key_ant_availability, check_ant_rate_limit, check_key_gemini_availability, check_key_azure_availability, get_azure_status, get_azure_deploy, check_key_mistral_availability, check_mistral_quota, check_key_replicate_availability, check_key_aws_availability, check_key_or_availability, check_key_or_limits
4
 
5
  async def sort_key(key, rate_limit, claude_opus):
6
  _key = key.strip()
7
 
8
- if _key.startswith("sk-or-v1-"):
9
  return get_key_openrouter_info(_key)
10
 
11
- if _key.startswith("sk-ant-"):
12
  return await get_key_ant_info(_key, rate_limit, claude_opus)
13
 
14
  if _key.startswith("sk-"):
@@ -31,7 +31,7 @@ async def sort_key(key, rate_limit, claude_opus):
31
  return get_key_azure_info(endpoint, api_key)
32
 
33
  if _key.startswith("AKIA") and len(_key.split(':')[0]) == 20 and _key.split(':')[0].isupper():
34
- return get_key_aws_info(_key)
35
 
36
  if len(_key) == 32:
37
  return get_key_mistral_info(_key)
@@ -158,8 +158,8 @@ def get_key_replicate_info(key):
158
  info_dict['hardware_available'] = key_avai[3]
159
  return info_dict
160
 
161
- def get_key_aws_info(key):
162
- key_avai = check_key_aws_availability(key)
163
  info_dict = {#"account_name": "",
164
  "key_type": "Amazon AWS Claude",
165
  "key_availability": key_avai[0],
@@ -230,7 +230,7 @@ with gr.Blocks() as demo:
230
  gr.Markdown('''
231
  # OpenAI/Anthropic/Gemini/Azure/Mistral/Replicate/AWS Claude/OpenRouter API Key Status Checker
232
 
233
- *(Based on shaocongma, CncAnon1, Drago and kingbased key checkers)*
234
 
235
  AWS credential's format: AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY (root might not be accurate)
236
 
 
1
  import gradio as gr
2
+ import requests, re
3
  from api_usage import get_subscription, check_key_availability, check_key_ant_availability, check_ant_rate_limit, check_key_gemini_availability, check_key_azure_availability, get_azure_status, get_azure_deploy, check_key_mistral_availability, check_mistral_quota, check_key_replicate_availability, check_key_aws_availability, check_key_or_availability, check_key_or_limits
4
 
5
  async def sort_key(key, rate_limit, claude_opus):
6
  _key = key.strip()
7
 
8
+ if _key.startswith("sk-or-v1-") and re.match(re.compile("sk-or-v1-[a-z0-9]{64}"), _key):
9
  return get_key_openrouter_info(_key)
10
 
11
+ if _key.startswith("sk-ant-") and len(_key) == 109:
12
  return await get_key_ant_info(_key, rate_limit, claude_opus)
13
 
14
  if _key.startswith("sk-"):
 
31
  return get_key_azure_info(endpoint, api_key)
32
 
33
  if _key.startswith("AKIA") and len(_key.split(':')[0]) == 20 and _key.split(':')[0].isupper():
34
+ return await get_key_aws_info(_key)
35
 
36
  if len(_key) == 32:
37
  return get_key_mistral_info(_key)
 
158
  info_dict['hardware_available'] = key_avai[3]
159
  return info_dict
160
 
161
+ async def get_key_aws_info(key):
162
+ key_avai = await check_key_aws_availability(key)
163
  info_dict = {#"account_name": "",
164
  "key_type": "Amazon AWS Claude",
165
  "key_availability": key_avai[0],
 
230
  gr.Markdown('''
231
  # OpenAI/Anthropic/Gemini/Azure/Mistral/Replicate/AWS Claude/OpenRouter API Key Status Checker
232
 
233
+ *(Based on shaocongma, CncAnon1, su, Drago, kingbased key checkers)*
234
 
235
  AWS credential's format: AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY (root might not be accurate)
236