malepati/custom_template_working
0
1from anthropic import AsyncAnthropic2from openai import AsyncOpenAI3from google import genai4 5 6async def list_available_openai_compatible_models(url: str, api_key: str) -> list[str]:7 client = AsyncOpenAI(api_key=api_key, base_url=url)8 models = (await client.models.list()).data9 if models:10 return list(map(lambda x: x.id, models))11 return []12 13 14async def list_available_anthropic_models(api_key: str) -> list[str]:15 client = AsyncAnthropic(api_key=api_key)16 return list(map(lambda x: x.id, (await client.models.list(limit=50)).data))17 18 19async def list_available_google_models(api_key: str) -> list[str]:20 client = genai.Client(api_key=api_key)21 return list(map(lambda x: x.name, client.models.list(config={"page_size": 50})))22 