Groq
Replace https://api.groq.com/
with https://llmfoundry.straive.com/groq/
.
All Groq models and APIs are supported, including:
llama-3.3-70b-versatile
llama-3.2-90b-vision-preview
llama-3.2-11b-vision-preview
gemma2-9b-it
mixtral-8x7b-32768
whisper-large-v3
Curl
curl -X POST https://llmfoundry.straive.com/groq/openai/v1/chat/completions \
-H "Authorization: Bearer $LLMFOUNDRY_TOKEN:my-test-project" \
-H "Content-Type: application/json" \
-d '{"model": "llama-3.3-70b-versatile", "messages": [{"role": "user", "content": "What is 2 + 2"}]}'
Python requests
import os
import requests # Or replace requests with httpx
response = requests.post(
"https://llmfoundry.straive.com/groq/openai/v1/chat/completions",
headers={"Authorization": f"Bearer {os.environ['LLMFOUNDRY_TOKEN']}:my-test-project"},
json={"model": "llama-3.3-70b-versatile", "messages": [{"role": "user", "content": "What is 2 + 2"}]}
)
print(response.json())
JavaScript
const token = process.env.LLMFOUNDRY_TOKEN;
const response = await fetch("https://llmfoundry.straive.com/groq/openai/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}:my-test-project` },
// If the user is already logged into LLM Foundry, use `credentials: "include"` to send **THEIR** API token instead of the `Authorization` header.
credentials: "include",
body: JSON.stringify({
model: "llama-3.3-70b-versatile",
messages: [{ role: "user", content: "What is 2 + 2" }],
}),
});
console.log(await response.json());
LangChain
import os
from langchain_groq import ChatGroq
# Chat
chat_model = ChatGroq(
api_key=f"{os.environ['LLMFOUNDRY_TOKEN']}:my-test-project",
base_url="https://llmfoundry.straive.com/groq/",
model_name="llama-3.3-70b-versatile",
)
print(chat_model.invoke("What is 2 + 2?").content)