Spaces:
Running
Running
| import asyncio | |
| import httpx | |
| from config import get_settings | |
| async def list_models(): | |
| settings = get_settings() | |
| async with httpx.AsyncClient() as client: | |
| res = await client.get( | |
| "https://api.groq.com/openai/v1/models", | |
| headers={"Authorization": f"Bearer {settings.groq_api_key}"} | |
| ) | |
| data = res.json() | |
| models = [m['id'] for m in data.get('data', [])] | |
| print("MODELS:", models) | |
| if __name__ == "__main__": | |
| asyncio.run(list_models()) | |