simple-groq-rs-0.1.2 has been yanked.
simple-groq-rs
A minimal, ergonomic, async Rust client for the Groq inference API.
Groq provides lightning-fast inference for open-source models (Llama 3.1, Mixtral, Gemma, etc.) and is fully compatible with the OpenAI API format. This crate gives you a clean, lightweight way to call Groq from Rust with almost zero overhead.
Features
- Simple, idiomatic API
- Async (powered by
reqwest) - No heavy dependencies
- Easy environment variable setup
- Ready for streaming, vision, and tools (future extensions)
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start:
- Get a free API key at console.groq.com/keys (no credit card required).
- Set the key in your environment:
Code Exmaple:
use simple_groq_rs::{GroqClient, Message};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GroqClient::from_env()?; // Loads GROQ_API_KEY automatically
let messages = vec![
Message::system("You are a helpful and concise assistant."),
Message::user("Explain Rust's borrow checker in one short paragraph."),
];
let response = client
.chat_completion("llama-3.1-70b-versatile", messages, None, None)
.await?;
println!("Groq response:\n{}", response);
Ok(())
}
Popular free-tier models (as of Dec 2025):
- llama-3.1-8b-instant – fastest, great for quick tasks
- llama-3.1-70b-versatile – highest quality
- mixtral-8x7b-32768
- gemma2-9b-it
Running Examples:
This crate includes ready-to-run examples:
# Set your key (once per terminal session)
# Simple chat example
# List all models available to your account