Framework Integrations

Observyze provides Proxy Gateway integrations for popular frameworks like LangChain, LlamaIndex, and the Vercel AI SDK. By routing through our proxy or using our SDK wrappers, model calls and agent workflows are automatically traced.

Dedicated Provider Integration Guides

LangChain Integration

The easiest way to trace LangChain is to point the base URL to the Observyze proxy.

TypeScript Example
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({
  configuration: {
    baseURL: "https://api.observyze.com/api/v1/proxy/openai/v1",
    defaultHeaders: {
      "Authorization": "Bearer ob_your_api_key",
      "x-project-id": "proj_123"
    }
  }
});

Vercel AI SDK

Use the custom provider setup to route Vercel AI SDK traffic through Observyze.

Next.js Route Handler
import { createOpenAI } from '@ai-sdk/openai';
import { generateText } from 'ai';

const observyzeProvider = createOpenAI({
  baseURL: 'https://api.observyze.com/api/v1/proxy/openai/v1',
  headers: {
    Authorization: `Bearer ${process.env.OBSERVYZE_API_KEY}`,
    'x-project-id': process.env.OBSERVYZE_PROJECT_ID
  }
});

export async function POST(req: Request) {
  const { text } = await generateText({
    model: observyzeProvider('gpt-4o'),
    prompt: 'Write a poem about tracing',
  });
  
  return Response.json({ text });
}

Ollama (Local Models)

Trace local open-source models (Llama 3.2, DeepSeek-R1, Mistral, Qwen 2.5, Phi-3) running on your local machine with zero API cost attribution.

TypeScript SDK (OpenAI-compatible)
import OpenAI from "openai";
import { ObservyzeClient } from "@observyze/sdk";

const observyze = new ObservyzeClient({
  apiKey: process.env.OBSERVYZE_API_KEY!,
  projectId: process.env.OBSERVYZE_PROJECT_ID!,
});

// Point OpenAI client at local Ollama instance
const openai = observyze.wrapOpenAI(
  new OpenAI({
    baseURL: "http://localhost:11434/v1",
    apiKey: "ollama", // Required by SDK, ignored by Ollama
  })
);

const response = await openai.chat.completions.create({
  model: "llama3.2",
  messages: [{ role: "user", content: "Summarize this agent task" }],
});

console.log(response.choices[0].message.content);
Python (LangChain / OpenAI-compatible)
from openai import OpenAI
from observyze import ObservyzeClient

observyze = ObservyzeClient(
    api_key="ob_your_api_key",
    project_id="proj_123"
)

# Instrument local Ollama
client = observyze.wrap_openai(
    OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
)

response = client.chat.completions.create(
    model="llama3.2",
    messages=[{"role": "user", "content": "Explain circuit breakers in distributed systems"}]
)

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