/ ai_quick.py
ai_quick.py
1 #!/usr/bin/env python3 2 import requests 3 import sys 4 api_key = "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" 5 question = sys.argv[1] if len(sys.argv) > 1 else "Hello" 6 r = requests.post("https://api.groq.com/openai/v1/chat/completions", 7 headers={"Authorization": f"Bearer {api_key}"}, 8 json={"model": "mixtral-8x7b-32768", 9 "messages": [{"role": "user", "content": question}], 10 "max_tokens": 1000}) 11 print(r.json()["choices"][0]["message"]["content"])