Groq
Portkey + Groq
Portkey is the Control Panel for AI apps. With it’s popular AI Gateway and Observability Suite, hundreds of teams ship reliable, cost-efficient, and fast apps.
With Portkey, you can
- Connect to 150+ models through a unified API,
- View 40+ metrics & logs for all requests,
- Enable semantic cache to reduce latency & costs,
- Implement automatic retries & fallbacks for failed requests,
- Add custom tags to requests for better tracking and analysis and more.
Use blazing fast Groq API with OpenAI Compatibility using Portkey!
Since Portkey is fully compatible with the OpenAI signature, you can connect to the Portkey AI Gateway through OpenAI Client.
- Set the
base_url
asPORTKEY_GATEWAY_URL
- Add
default_headers
to consume the headers needed by Portkey using thecreateHeaders
helper method.
You will need Portkey and Groq API keys to run this notebook.
With OpenAI Client
With Portkey Client
Note: You can safely store your Groq API key in Portkey and access models using virtual key
Advanced Routing - Load Balancing
With load balancing, you can distribute load effectively across multiple API keys or providers based on custom weights to ensure high availability and optimal performance.
Let’s take an example where we might want to split traffic between Groq’s llama-3-70b
and OpenAI’s gpt-3.5
giving a weightage of 70-30.
The gateway configuration for this would look like the following:
Observability with Portkey
By routing requests through Portkey you can track a number of metrics like - tokens used, latency, cost, etc.
Here’s a screenshot of the dashboard you get with Portkey!