Mlflow
MLflow plugin for opencode - tracks sessions, tool executions, and metrics in your local MLflow server
0
209
9 in 7 days
33.8
Multi-signal model
15 days ago
2026-09-19
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-mlflow-plugin@1.0.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-mlflow-plugin@1.0.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-mlflow-pluginOpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
OpenCode plugin that sends LLM tracing data to MLflow with full observability: token counts, costs, model info, generation parameters, and GenAI semantic conventions.
What it captures
| Category | Fields |
|---|---|
| Tokens | input, output, reasoning, cache read/write, total |
| Model | model ID, provider, agent name |
| Cost | USD cost per turn |
| Generation | temperature, topP, topK, maxTokens |
| Finish | stop, tool-calls, etc. |
| Request/Response | Full prompt and completion text |
| MLflow metrics | message_count, tool_count, duration_ms |
Setup
- Place
send_trace.pyanddist/in your plugin directory - Add to
opencode.json:
{
"plugin": ["C:/path/to/opencode-mlflow-plugin/dist/index.js"]
}
- Ensure MLflow is running on
http://localhost:5000(or configuretrackingUri)
Options
{
"plugin": [["C:/path/to/dist/index.js", {
"trackingUri": "http://localhost:5000",
"experimentName": "opencode-sessions",
"logSpans": true,
"logTokens": true,
"logToolDetails": false
}]]
}
| Option | Default | Description |
|---|---|---|
trackingUri |
http://localhost:5000 |
MLflow tracking server URL |
experimentName |
opencode-sessions |
MLflow experiment name |
logSpans |
true |
Create MLflow traces with spans |
logTokens |
true |
Capture token counts |
logToolDetails |
false |
Log individual tool execution durations as metrics |
How it works
- Listens to OpenCode events (
chat.message,message.updated,chat.params, tool events) - Accumulates token counts across parallel assistant messages in a turn
- Uses a 2-second debounce to handle multiple assistant messages per turn
- Sends traces to MLflow via a Python subprocess using the MLflow SDK (synchronous mode)
- Creates LLM-type spans with GenAI semantic convention attributes
Requirements
- Python 3.10+ with
mlflowinstalled (pip install mlflow) - MLflow tracking server running
- OpenCode with plugin support
License
MIT
Similar plugins
Vitals
opencode-vitals
OpenCode V2 plugin that shows session turns, steps, and average streaming tok/s inside OpenCode's own composer
Hard Limit
opencode-hard-limit
OpenCode plugin that hard-stops model calls before you burn through your AI quota. Monitors the 5h or weekly window for Claude and OpenAI, blocks at a configurable percent-remaining threshold, and shows a live usage bar in the sidebar. Set your goal per-p
Hud
opencode-hud
OpenCode plugin that displays TPS, TTFT, and token metrics at conversation end.