OpenAI, Anthropic, and Gemini tracing package for LLM applications.
Project description
freesolo
freesolo is a Python tracing package for LLM apps.
For the Node/npm package, see npm/.
It is built for the lowest-friction integration possible:
- Install the package
- Set
FREESOLO_API_KEY - Wrap your OpenAI, Anthropic, Gemini, or OpenAI-compatible client
- Call the client normally
Current provider support
freesolo currently supports automatic client instrumentation for:
- OpenAI
- Anthropic
- Gemini
- OpenAI-compatible clients via
wrap(...)/wrap_provider(...)
Install
Install the package plus the provider SDK you use:
pip install freesolo openai
or
pip install freesolo anthropic
or
pip install freesolo google-genai
Environment
FREESOLO_API_KEY
Quickstart
from openai import OpenAI
from freesolo import wrap
client = wrap(OpenAI())
result = client.responses.create(
model="gpt-4.1-mini",
instructions="Reply in plain text.",
input=[
{
"role": "user",
"content": [{"type": "input_text", "text": "How do I reset my password?"}],
}
],
)
print(result.output_text or "")
OpenRouter Quickstart
from openai import OpenAI
from freesolo import wrap
client = wrap(
OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="YOUR_OPENROUTER_API_KEY",
)
)
response = client.chat.completions.create(
model="openai/gpt-4.1-mini",
messages=[
{"role": "system", "content": "Reply in plain text."},
{"role": "user", "content": "Write a one-sentence launch blurb."},
],
max_tokens=120,
)
print(response.choices[0].message.content or "")
Gemini Quickstart
from google import genai
from freesolo import instrument_gemini
client = instrument_gemini(genai.Client())
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Write a one-sentence release note for traced Gemini support.",
)
print(response.text or "")
Group Multiple Model Calls
For agentic or long-horizon tasks, strongly prefer wrapping the whole task in start_trace(...) so all of the model calls land in one trace.
For a single one-off OpenAI, Anthropic, or Gemini request, you can skip it.
from anthropic import Anthropic
from freesolo import instrument_anthropic, start_trace
client = instrument_anthropic(Anthropic())
with start_trace("support-agent-run"):
first = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=64,
messages=[{"role": "user", "content": "Say hello"}],
)
second = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=64,
messages=[{"role": "user", "content": "Say goodbye"}],
)
What Gets Stored
- Trace title if you explicitly pass it to
start_trace("...") - Trace metadata if you explicitly pass it to
start_trace(..., metadata=...) - Input payloads with
system_prompt,user_prompt, andimages - Output payloads as plain text
- Token usage when available
- Image inputs with inline previews for the trace UI
Notes
- You do not need
@trace()for ordinary LLM tracing. - A single instrumented OpenAI, Anthropic, or Gemini request creates a trace automatically.
- For OpenAI-compatible providers like OpenRouter, prefer
wrap(...)instead of provider-specific helpers. - For agentic or long-horizon workflows, strongly recommend
start_trace("descriptive-title")so planning, retries, and follow-up calls stay grouped. - Delivery is best-effort by default. Trace ingestion failures do not break your app.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freesolo-0.1.4.tar.gz.
File metadata
- Download URL: freesolo-0.1.4.tar.gz
- Upload date:
- Size: 98.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d61f02923a678b0b38ebab0b79b62a5a60acb3c7f54515af8b0766692d3e891d
|
|
| MD5 |
563f07e263bc006021111a872b19104b
|
|
| BLAKE2b-256 |
69abf05cc5fbf50389eab75d775509d1469e0fcda1bf7352933caece495720e8
|
File details
Details for the file freesolo-0.1.4-py3-none-any.whl.
File metadata
- Download URL: freesolo-0.1.4-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81bbdab6245a96b26894fa184e6abcf09882b0b3933361959895344e2882cd75
|
|
| MD5 |
490eb0ff124d74231c4e29717251574d
|
|
| BLAKE2b-256 |
660e497f73124f43928a4d53cf5d06623da872f6bb5f1e1e3b92fa530de543bb
|