MCPcopy Index your code
hub / github.com/OpenRouterTeam/python-sdk / get_security_from_env

Function get_security_from_env

src/openrouter/utils/security.py:70–82  ·  view source on GitHub ↗
(security: Any, security_class: Any)

Source from the content-addressed store, hash-verified

68
69
70def get_security_from_env(security: Any, security_class: Any) -> Optional[BaseModel]:
71 if security is not None:
72 return security
73
74 if not issubclass(security_class, BaseModel):
75 raise TypeError("security_class must be a pydantic model class")
76
77 security_dict: Any = {}
78
79 if os.getenv("OPENROUTER_API_KEY"):
80 security_dict["api_key"] = os.getenv("OPENROUTER_API_KEY")
81
82 return security_class(**security_dict) if security_dict else None
83
84
85def _parse_security_option(

Callers 15

listMethod · 0.90
list_asyncMethod · 0.90
get_creditsMethod · 0.90
get_credits_asyncMethod · 0.90
generateMethod · 0.90
generate_asyncMethod · 0.90
get_generationMethod · 0.90
get_generation_asyncMethod · 0.90
get_video_contentMethod · 0.90
list_videos_modelsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected