MCPcopy
hub / github.com/RayVentura/ShortGPT / get_api_key

Method get_api_key

shortGPT/config/api_db.py:17–32  ·  view source on GitHub ↗
(cls, key: str | ApiProvider)

Source from the content-addressed store, hash-verified

15
16 @classmethod
17 def get_api_key(cls, key: str | ApiProvider):
18 if isinstance(key, ApiProvider):
19 key = key.value
20
21 # Check if the key is present in the database
22 api_key = cls.api_key_doc_manager._get(key)
23 if api_key:
24 return api_key
25
26 # If not found in the database, check in the environment variables
27 env_key = key.replace(" ", "_").upper()
28 api_key = os.environ.get(env_key)
29 if api_key:
30 return api_key
31
32 return ""
33
34 @classmethod
35 def set_api_key(cls, key: str | ApiProvider, value: str):

Callers 12

llm_completionFunction · 0.80
search_videosFunction · 0.80
__init__Method · 0.80
verify_eleven_keyMethod · 0.80
save_keysMethod · 0.80
create_uiMethod · 0.80
translate_videoMethod · 0.80
getElevenlabsVoicesMethod · 0.80
is_key_missingMethod · 0.80
respondMethod · 0.80
create_shortMethod · 0.80
inspect_create_inputsMethod · 0.80

Calls 2

getMethod · 0.80
_getMethod · 0.45

Tested by

no test coverage detected