docs
Python SDK
Configuration

Configuration

Full Configuration Example

from observiq_sdk import ObservIQ
 
oiq = ObservIQ(
    api_key="oiq_your_key_here",
    base_url="https://your-backend.railway.app",
    enabled=True
)

Configuration Options

OptionTypeDefaultDescription
api_keystrrequiredYour ObservIQ API key starting with oiq_
base_urlstrhttp://localhost:8000URL of your ObservIQ backend
enabledboolTrueToggle tracing on/off

Using with Environment Variables

import os
from observiq_sdk import ObservIQ
 
oiq = ObservIQ(
    api_key=os.environ["OBSERVIQ_API_KEY"],
    base_url=os.environ.get("OBSERVIQ_URL", "http://localhost:8000"),
    enabled=os.environ.get("OBSERVIQ_ENABLED", "true").lower() == "true"
)

Using with Django / FastAPI

# settings.py or config.py — initialize once, import everywhere
from observiq_sdk import ObservIQ
import os
 
observiq = ObservIQ(
    api_key=os.environ["OBSERVIQ_API_KEY"],
    base_url=os.environ["OBSERVIQ_URL"]
)
# views.py / routes.py
from config import observiq
from groq import Groq
 
groq_client = Groq(api_key=os.environ["GROQ_API_KEY"])
 
async def chat_endpoint(message: str):
    with observiq.trace(model="llama-3.3-70b-versatile", feature_name="chat"):
        response = groq_client.chat.completions.create(
            model="llama-3.3-70b-versatile",
            messages=[{"role": "user", "content": message}]
        )
    return response.choices[0].message.content