Route Groq model calls through Respan Gateway using your own Groq credits.
This section is for Respan LLM gateway users.
Use Respan Gateway to call Groq models while keeping unified observability (logs, cost, latency, and reliability metrics) in Respan — and optionally charge usage to your own Groq credits.
You can pass credentials dynamically in the request body. This is useful if you need to use your users’ own API keys (BYOK credits).Add the customer_credentials parameter to your Gateway request:
Copy
{ // Rest of the request body "customer_credentials": { "groq": { "api_key": "YOUR_GROQ_API_KEY" } }}
If you are not using the Gateway to proxy requests, you can still log your Groq requests to Respan asynchronously. This allows you to track cost, latency, and performance metrics for external calls.
Groq Python SDK
Copy
import requestsurl = "https://api.respan.ai/api/request-logs/create/"payload = { "model": "llama3-8b-8192", "prompt_messages": [ { "role": "user", "content": "Write a short poem about AI" } ], "completion_message": { "role": "assistant", "content": "In circuits bright and data streams, AI awakens from digital dreams..." }, "cost": 0.0001, "generation_time": 0.8, "customer_params": { "customer_identifier": "user_101" }}headers = { "Authorization": "Bearer YOUR_RESPAN_API_KEY", "Content-Type": "application/json"}response = requests.post(url, headers=headers, json=payload)