File size: 505 Bytes
6ab86fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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())