Integrations / Ollama
To trace Ollama with Tracify, use the OpenAI client pointed at Ollama's local /v1 endpoint and wrap it with the Tracify SDK. Each local call is recorded with the model, tokens and latency.
Your code
Ollama
Tracify
One run.
Setup
Start Ollama and pull a model once. The compatible API listens on port 11434.
ollama pull llama3.2The OpenAI library talks to Ollama, so no Ollama-specific package is needed.
pip install tracify-sdk openaiCreate a project in Tracify, copy its API key and put it in the environment where your code runs. The SDK reads it from there, so nothing is hard-coded.
export TRACIFY_API_KEY="tracify_sk_live_..."Ollama ignores the API key but the library wants one, so any text works.
import tracify
from openai import OpenAI
ollama = tracify.wrap_openai(OpenAI(
base_url="http://localhost:11434/v1",
api_key="ollama",
))
reply = ollama.chat.completions.create(
model="llama3.2",
messages=[{"role": "user", "content": "Hello"}],
)Same endpoint, same wrapper.
import OpenAI from "openai";
import { wrapOpenAI } from "tracify-sdk";
const ollama = wrapOpenAI(
new OpenAI({ baseURL: "http://localhost:11434/v1", apiKey: "ollama" }),
);
const reply = await ollama.chat.completions.create({
model: "llama3.2",
messages: [{ role: "user", content: "Hello" }],
});Run your code one time, then open the Tracing page of your project. Your local call shows up as a run with its steps in order, plus the tokens, time and any error for each call.
Good to know
The wrapper reads the OpenAI call format, so calls are labeled as OpenAI-style in the trace. The model name you send is always the one shown, so you can still tell models apart.
Good to know
The model runs locally, but Tracify is a hosted service, so the prompts and answers you record are sent to it. To keep content out, turn off input and output capture on the wrapper, or use the redaction options in the SDK.
Good to know
Tracify only shows a dollar cost when you pass your own rates. For local models you can leave it out, or put in an estimate of your hardware cost per token.
Full details in the documentation. All integrations are listed on the integrations page.
