Groq SDK Integration

Integrate Proxy with the Groq SDK to automatically capture telemetry. Demonstrated with Groq’s Python SDK but should work in most languages.

Base URL

https://gateway.adaline.ai/v1/groq/

Chat Completions

Complete Chat

from groq import Groq

client = Groq(
    api_key="your-groq-api-key",
    base_url="https://gateway.adaline.ai/v1/groq/"
)

headers = {
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id"
}

response = client.chat.completions.create(
    model="llama3-8b-8192",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the speed of light?"}
    ],
    extra_headers=headers
)

print(response.choices[0].message.content)

Stream Chat

from groq import Groq

client = Groq(
    api_key="your-groq-api-key",
    base_url="https://gateway.adaline.ai/v1/groq/"
)

headers = {
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id"
}

stream = client.chat.completions.create(
    model="llama3-8b-8192",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain how neural networks work."}
    ],
    stream=True,
    extra_headers=headers
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")

Next Steps