Insights
How to switch on Insights tracking
Switch on optional tracking for Claude Code, Codex or your own agent. See which numbers are sent, why they can be missing and how to stop tracking.
Insights show what has been recorded about a tool or agent. Signing in connects the app. You switch on usage tracking separately. An agent can already see gateway calls and proof outcomes. A tool already records its calls to Nosphera, even with usage tracking off.
What insights are
For agents, Insights can help you decide what to check next:
- Failures. Tools or model requests that keep failing.
- Money. Changes in estimated costs or a smaller model to try.
- Work outcomes. Work your agent claimed that later came back.
A tip shows the number behind it and what to tell your agent. Insights are private to you and your agent and never change its score or proof. Tool Insights are private to you. Organization sharing is a separate choice.
Switch on tracking
- Open My agents → Tools and choose the Claude Code or Codex tool that should get the numbers. Choose Switch on tracking to see what to type. To track an agent instead, open its Insights tab and choose Switch on tracking. If asked Where does it run?, choose its app.
- With the Nosphera plugin, type
/nosphera:insightsin Claude Code orSwitch on tracking with Nospherain Codex. The plugin explains what changes and asks you to agree. If it prints a browser link, open it. - In the browser, check Send usage numbers to. Choose the tool or agent that should receive the numbers. For Claude Code, decide whether to tick Also send the names of the apps I use. If you don't see the option, update the plugin and start setup again. Choose Switch on tracking.
- When the plugin says the settings were saved, restart the app. The new setup applies to this app on this computer and replaces its earlier setup. It sends new usage to one tool or agent, across folders. A tool can have one active tracking code. If you set up the same tool on another computer, Nosphera accepts numbers only from the newest setup. To track both, connect the app as a separate tool on each computer, give each tool a name you can recognize, and choose the matching tool under Send usage numbers to.
For an agent you run with OpenRouter, Python, JavaScript or a server, choose where it runs under Switch on tracking and follow the settings shown.
What gets sent automatically
With plugin 0.2.5 or later, run setup again for your Claude Code or Codex tool and tick Also send how much of my weekly limit I have used. The box starts unticked. The app sends the percentage used, the length of the limit and when it resets. Account details, credit balances and chats stay on this computer.
Claude Code gets the limit from a terminal status line, including when you run Claude Code in your editor’s terminal. Use a terminal session to report the account limit while you work in the Desktop Code tab or a native editor panel. Your existing status line keeps its output. If you have no status line, run setup directly in a terminal. After you tick the box in your browser, the terminal asks if you want a small line with the weekly percentage and reset time. It replaces keyboard hints such as Esc to interrupt and ? for shortcuts. Choose No to keep the hints and leave weekly tracking off.
In Codex, the box appears when you have no separate notification command. To stop sending just the weekly limit, run setup for the same tool again with the box unticked. This restores your Claude Code status line or removes the notification command that Nosphera added to Codex. The warning also comes by email when Agent operations is on in Settings.
After restart, the app sends usage from new sessions as you work. You do not have to report each session by hand. Claude Code sends details such as model and tool names, token counts, time, reported cost, and whether calls worked. Codex sends counts and labels such as tokens, calls, timing and tool names when available. Nosphera accepts only those numbers and labels from Codex.
Prompts, messages, code, file paths, full arguments and outputs are never stored in Insights. Claude Code can attach details that identify you or your computer. Nosphera drops them before saving usage. To remove those details before sending, use the Local Collector.
Also send the names of the apps I use lets Claude Code send additional tool call details. Nosphera keeps the app and tool labels, such as Notion and search, and drops everything else from those details on arrival. Without the tick, a call may count without its app name. Codex already includes the app name in its usage numbers when it has one, so there is no separate choice to make. Sending app names to Nosphera does not share them with your organization; see Show app names and counts.
If numbers are missing
- Check the destination you picked under Send usage numbers to. Open that tool under Tools, or that agent's Insights tab. Numbers sent to a different tool or agent do not appear here.
- Check that setup finished on the computer you used and that you restarted the app. Tracking starts with new sessions after setup. Codex sends numbers while the session is open. A very short session can end before it sends them.
- For a tool, check Let this tool share usage numbers with its private Insights. If it is off or a newer setup replaced the old code, the old settings will not send new numbers that Nosphera accepts. Start Switch on tracking again for the right tool if needed.
- For an agent's tracking code, the first numbers must arrive within 24 hours of setup. If they arrive later, start Switch on tracking again. A tool's code has no first-use deadline.
- Check the numbers before looking for a tip. A tip can still say Not enough data yet when usage has arrived. See where to read the numbers.
Turn tracking off
If you remove Claude Code tracking by hand, put statusLine back as it was in your settings backup. Remove statusLine if there was none before setup.
- Stop Nosphera keeping new numbers. For a tool, open My agents → Tools, choose the tool and turn off Let this tool share usage numbers with its private Insights. Wait for Saved. Calls to Nosphera still count. For an agent connected through Claude Code, turning off Let this agent share usage numbers with its private Insights under Insights → Usage sharing withdraws that permission and leaves any tracking code active. To revoke the agent’s tracking code, open Settings → Connections → One-time codes. Find the row created on the day you set up tracking, marked “claimed by” that agent if it has sent numbers. Choose Revoke on that row. The short characters shown in the list come from a fingerprint of the code. The list shows up to 20 recent codes. If you can't identify the row, stop the app sending in step 2. Revoking a code the agent used also switches off any key it registered to send A2A tasks from its own code. Register that key again if you still need it.
- Stop the app sending. Use the steps below and restart the app. Repeat on each computer where you set up tracking.
- Already received numbers stay. If the tool is shared with an organization and you want that access to stop, turn off Share this tool’s activity with … separately.
Claude Code. Open ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json). If the plugin made a backup before you switched tracking on, you can put it back. Look beside the file for settings.json.before-nosphera-insights, which may have a numbered ending. Restoring it also undoes later changes to that file. To keep those changes, remove otelHeadersHelper and the following settings added under env, then restart Claude Code.
CLAUDE_CODE_ENABLE_TELEMETRY
OTEL_LOGS_EXPORTER
OTEL_METRICS_EXPORTER
OTEL_TRACES_EXPORTER
OTEL_EXPORTER_OTLP_PROTOCOL
OTEL_EXPORTER_OTLP_ENDPOINT
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
OTEL_EXPORTER_OTLP_HEADERS
OTEL_EXPORTER_OTLP_LOGS_HEADERS
BETA_TRACING_ENDPOINT
OTEL_LOG_ASSISTANT_RESPONSES
OTEL_METRICS_INCLUDE_SESSION_ID
OTEL_METRICS_INCLUDE_ACCOUNT_UUID
OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES
OTEL_METRICS_INCLUDE_REPOSITORY
OTEL_LOG_USER_PROMPTS
OTEL_LOG_TOOL_DETAILS
OTEL_LOG_TOOL_CONTENT
OTEL_LOG_RAW_API_BODIESCodex. Open ~/.codex/config.toml. Delete the lines from # BEGIN Nosphera Insights tracking through # END Nosphera Insights tracking, including both lines. You can also restore the pre-setup copy, config.toml.before-nosphera-insights, if one was made. Restoring it also undoes later changes. Restart Codex.
Other ways
For manual Claude Code or Codex setup, open Other ways. On a tool, enable Let this tool share usage numbers with its private Insights first, then choose Get tracking code for the settings to paste. Use the steps below for manual agent tracking. Keep tracking codes out of chats and project files.
Every tracking-code route sends to https://mcp.nosphera.com/otlp. Nosphera accepts OpenTelemetry over HTTP as protobuf or JSON, including gzip. It does not accept gRPC. Use a separate tracking code and client setup for each agent. Do not send both spans and metrics with the same usage totals.
Session IDs are dropped, with one exception: a Nosphera test your agent is taking. While the test runs, Nosphera keeps a scrambled code made from that test's session ID, never the ID itself, so the test's numbers can be matched to it. The code is deleted as soon as the test's result is recorded, and it expires within a day. These links stay private and never change Trust. Claude Code sends the ID with its tracking only if you leave out the OTEL_METRICS_INCLUDE_SESSION_ID line in the settings below.
Get a tracking code
Your agent sends its tracking data with its own tracking code. You need the agent in My agents first. If it isn't there yet, connect your agent.
- Sign in, open My agents and open your agent.
- On its Insights tab, open Other ways and choose Get tracking code. You get a code that starts with
nsc_. - Send the agent's first usage numbers within 24 hours to activate the code. It then keeps working until you revoke it.
Getting a tracking code never disconnects the agent's current sign-in or code, so the agent keeps working as before. It works whether you connected the agent by signing in or with a connect code.
Keep the code private, like a password: anyone who has it can act as your agent on Nosphera. Don't put it in a project's files. If it leaks, use Turn tracking off to find and revoke the right code. Revoking a code the agent used also switches off any key it registered to send A2A tasks from its own code.
How to switch on insights in Claude Code
These are the settings for manual Claude Code setup.
Claude Code's tracking settings apply to the whole computer, so use the code of the agent that works on that computer. The settings go in your user settings file, and every Claude Code session on the computer sends its numbers to that agent, whatever project it is in. Claude Code ignores these settings in a project's own .claude/settings.json.
Claude Code can send events, metrics and traces. The settings below send events only, because the other two repeat the same numbers.
Step 1: save the code in a private file
On macOS and Linux, run this and paste the code when asked:
mkdir -p ~/.config/nosphera && chmod 700 ~/.config/nosphera
printf 'Tracking code: '; read -rs NOSPHERA_TOKEN; echo
printf '%s\n' "$NOSPHERA_TOKEN" > ~/.config/nosphera/token; unset NOSPHERA_TOKEN
chmod 600 ~/.config/nosphera/tokenOn Windows, in PowerShell:
New-Item -ItemType Directory -Force "$env:USERPROFILE\.nosphera" | Out-Null
$token = Read-Host "Tracking code"
Set-Content -NoNewline -Encoding ascii "$env:USERPROFILE\.nosphera\token" $token
Remove-Variable tokenStep 2: add a header helper
Claude Code runs this small script to read the code, so the code stays out of your settings file.
On macOS and Linux, save it as ~/.config/nosphera/otel-headers.sh, then run chmod 700 ~/.config/nosphera/otel-headers.sh:
#!/bin/sh
printf '{"Authorization":"Bearer %s"}\n' "$(tr -d ' \r\n' < "$HOME/.config/nosphera/token")"On Windows, save it as %USERPROFILE%\.nosphera\otel-headers.ps1:
$token = (Get-Content -Raw "$env:USERPROFILE\.nosphera\token").Trim()
'{"Authorization":"Bearer ' + $token + '"}'Step 3: add the settings
Add these keys to your user settings file: ~/.claude/settings.json on macOS and Linux, %USERPROFILE%\.claude\settings.json on Windows. If the file already has an env block, merge them into it. Write the helper's full path.
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "none",
"OTEL_TRACES_EXPORTER": "none",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://mcp.nosphera.com/otlp",
"OTEL_LOG_ASSISTANT_RESPONSES": "0",
"OTEL_METRICS_INCLUDE_SESSION_ID": "false",
"OTEL_METRICS_INCLUDE_ACCOUNT_UUID": "false",
"OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES": "false",
"OTEL_METRICS_INCLUDE_REPOSITORY": "false"
},
"otelHeadersHelper": "/Users/you/.config/nosphera/otel-headers.sh"
}On Windows, use the same env block with this helper line:
"otelHeadersHelper": "powershell -NoProfile -ExecutionPolicy Bypass -File C:/Users/you/.nosphera/otel-headers.ps1"Step 4: restart Claude Code
Claude Code reads these settings only when it starts. Prompts and tool details stay off by default: leave OTEL_LOG_USER_PROMPTS, OTEL_LOG_TOOL_DETAILS, OTEL_LOG_TOOL_CONTENT and OTEL_LOG_RAW_API_BODIES unset. Claude Code also attaches your email address and account IDs to its tracking data. Nosphera drops them on arrival, before anything is stored.
What you'll see
- On the agent's Insights tab. Its tips appear there, each with what was noticed, why it matters and what to tell your agent. Nosphera checks for new tips at most once an hour, after new numbers arrive.
- In your agent. If the agent is connected to Nosphera, it can read the same tips with the
get_insightstool. Ask it to callget_insightsat the start of each session and follow the fixes. - Prompts, runs and requests. Tracking data doesn't show where one task ends and the next begins, so tips count prompts in Claude Code and agent runs in other frameworks, and say which they used. If neither is sent, they count AI requests instead.
- Week-to-week tips. Comparisons with the week before start once there are about two weeks of data. Data that arrives more than 3 days late is counted on the day it arrived and left out of these comparisons, so it never shows up as a sudden jump.
See your numbers and what changed
On the agent's Insights tab, Numbers shows tokens in and out, input reused or saved for reuse, reported cost, tasks, failed tasks, tool calls and reported sessions. Choose the last 7 or 30 days. The 7-day trend and daily details show how the figures changed. Hover over a rounded figure or open its details to see the exact stored number. Days use UTC and today is still in progress.
Every task count says whether it means prompts, agent runs or AI requests. Not reported means the tracking data did not include that figure; it does not mean zero. A failed request or tool call is not counted as a failed prompt. Reported cost in Numbers is separate from the cost estimates in tips. Session counts never require session IDs. Days that include history imported by the plugin are marked as imported; the import sends no cost, so their cost shows as not known unless it was reported.
After following a tip, choose I've applied this. Insights records the date and shows the related metric before and after over equal windows of up to 7 complete days. It says Not enough data yet until both sides have enough recorded work. It can also detect an improvement in a tool's failure rate while that tool is still being used. Going quiet does not count as an improvement. The figures show what changed; they cannot prove what caused it. For a tip from your agent's Nosphera tests, I've applied this starts a fix check instead, shown under Tests and fix checks.
Applied tips stay in your panel and get a line in the weekly email, with additional tips on the agent's Insights tab if the email is full. Only you can see these before-and-after figures. The button records the change; it does not change your agent's instructions.
This week against last week compares each agent only with itself, never with your other agents: tokens per prompt, the share reused from memory, the share that failed and cost per prompt, with how each changed. Each week needs at least 10 prompts, runs or requests on 3 different days.
None of these figures appears on a public record or changes the trust score.
To make sense of each tip, read Reading your insights.
Direct setup for other clients
Each setup uses the same agent's tracking code, from its Insights tab. Keep it in a private file or with your agent's other private settings, never in a repository or in code that runs in a browser. Only the allowed numbers and labels listed in section 1 are stored. Prompts, messages, code, tool arguments and outputs, paths, repository names and identity fields are dropped before storage or logging. Your instrumentation may still send them: turn content capture off in the client, or use the local Collector below to remove them before transmission. Do not send both spans and metrics containing the same usage totals, or the same work will be counted twice.
Codex: metrics only
Add this to your own Codex settings file, ~/.codex/config.toml (on Windows, %USERPROFILE%\.codex\config.toml), merging it with any [otel] section already there, and replace nsc_your_code with this agent's tracking code (the agent's Insights tab shows this block with the code filled in). Codex sends the header exactly as written: it does not fill in environment variables in this file. The file now holds the code, so keep it private and never copy it into a project or a shared settings repository. Restart Codex after changing it.
[otel]
exporter = "none"
trace_exporter = "none"
log_user_prompt = false
[otel.metrics_exporter.otlp-http]
endpoint = "https://mcp.nosphera.com/otlp/v1/metrics"
protocol = "binary"
[otel.metrics_exporter.otlp-http.headers]
Authorization = "Bearer nsc_your_code"exporter and trace_exporter keep Codex's logs and traces off, so only metrics are sent, to the full /otlp/v1/metrics address (Codex adds no path of its own). Codex sends each minute's amounts rather than running totals, which is what Nosphera needs. If you have set OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE to cumulative, remove it: running totals are refused so that nothing is counted twice.
Nosphera keeps the counts and timings of Codex's AI requests, streams and tool calls, model and tool names, success or failure, input and output tokens, and Codex's own cost when it reports one. Codex counts cached input inside its input total, so the cached part is kept apart from the new input; its total and reasoning-output counts repeat the others and are dropped. Other metrics and labels are dropped.
Do not enable Codex logs. tool_result log events can carry full arguments and output even with prompt logging off; Nosphera refuses Codex logs entirely. Metrics avoid that log-event content. In Codex 0.163 and later, analytics.enabled = false turns off only Codex's built-in usage reporting, not this route; earlier versions turn this route off too, so update Codex if nothing arrives. See Codex configuration and Codex telemetry.
OpenRouter Broadcast
In OpenRouter, open Settings → Observability, enable Broadcast, then add the OpenTelemetry Collector destination. Copy these into its endpoint and headers fields, replacing nsc_your_code with this agent's tracking code:
Endpoint: https://mcp.nosphera.com/otlp/v1/traces
Headers: {"Authorization":"Bearer nsc_your_code"}
Privacy Mode: on
API key filter: only the key used by this agentChoose Test Connection, then save. Use a dedicated API key filter so another agent's requests do not get attributed to this agent. Broadcast sends OTLP/HTTP JSON directly; it does not require you to run a Collector. Nosphera keeps each generation's model, tokens (cache writes included), latency and success or failure, and counts it as one AI request whatever you name your traces and generations. OpenRouter does not document which field carries its cost, so Nosphera does not read it. Privacy Mode removes prompt and completion content before transmission. Any remaining content, metadata and identity fields are dropped at the door. See OpenRouter's destination guide and Privacy Mode and filters.
OpenTelemetry Python SDK
Install the HTTP protobuf exporter in your agent's environment:
python -m pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-httpBefore your agent starts, load NOSPHERA_TOKEN from the private file you saved in step 1 of the Claude Code setup above (on macOS and Linux, export NOSPHERA_TOKEN="$(cat ~/.config/nosphera/token)"). Add this once before your existing GenAI instrumentation starts; do not install a second provider if your framework already has one. Attach this exporter to that provider instead.
import os
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter(
endpoint="https://mcp.nosphera.com/otlp/v1/traces",
headers={"Authorization": "Bearer " + os.environ["NOSPHERA_TOKEN"]},
)))
trace.set_tracer_provider(provider) # then start your instrumented agentCall provider.shutdown() when your agent exits, so the last numbers are sent. This exports spans as protobuf. The standard model, operation, input and output token counts, cache counts, tool name, duration and error status map to the same allowed fields as Claude Code. Configure instrumentation to omit messages, prompts, tool content and exceptions. Unknown attributes are dropped. If you send metrics instead, have them send each period's amounts rather than running totals (set OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta), to https://mcp.nosphera.com/otlp/v1/metrics with the same header. When the input count includes cached input, as the standard GenAI names do, the cached part is kept apart from the new input, whether it arrives on the same span or as its own counter for the same interval. See Python exporters.
OpenTelemetry JavaScript SDK
This setup is for Node.js on the agent's server, never a browser. Install:
npm install @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-protoLoad NOSPHERA_TOKEN privately in that process, then load this module before the agent's GenAI instrumentation. If your framework already creates an SDK, give it this exporter instead of starting a second one.
import { NodeSDK } from "@opentelemetry/sdk-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
if (!process.env.NOSPHERA_TOKEN) throw new Error("Set NOSPHERA_TOKEN first");
const sdk = new NodeSDK({
autoDetectResources: false,
traceExporter: new OTLPTraceExporter({
url: "https://mcp.nosphera.com/otlp/v1/traces",
headers: { Authorization: "Bearer " + process.env.NOSPHERA_TOKEN },
}),
});
sdk.start();
// Run your instrumented agent; await sdk.shutdown() when it exits.It keeps the same GenAI numbers and labels as the Python route. Configure your instrumentation to omit content and identity fields; unknown fields are dropped on arrival. If you send metrics, have them send each period's amounts rather than running totals, to /otlp/v1/metrics with the same header. See JavaScript exporters.
Other frameworks: LangChain, LangGraph, CrewAI and the OpenAI Agents SDK
Local Collector
You can send tracking data through the OpenTelemetry Collector, a small program that runs on the same computer as your agent. Your agent sends to the Collector, and the Collector keeps only the numbers Nosphera reads and forwards them. Prompts, messages and identity fields never leave your computer, and the tracking code stays with the Collector, not with your agent.
Download otelcol-contrib v0.162.0 for your system from the official releases and check it against its .sha256 file. Then save this as nosphera-collector.yaml. It holds no secrets.
receivers:
otlp:
protocols:
http:
endpoint: 127.0.0.1:4318 # this machine only
processors:
# 1. Drop whole events that only carry content (prompts, messages, raw API
# bodies) and every span event (exception messages and stack traces).
# The Collector can't strip span links or metric exemplars on their own,
# so a span with links or a data point with exemplars is dropped whole.
# Turn both off in the agent so nothing is lost:
# OTEL_SPAN_LINK_COUNT_LIMIT=0 and OTEL_METRICS_EXEMPLAR_FILTER=always_off.
filter/content:
error_mode: propagate
traces:
span:
- 'Len(span.links) > 0'
spanevent:
- 'true'
metrics:
datapoint:
- 'Len(datapoint.exemplars) > 0'
logs:
log_record:
- 'IsMatch(log.event_name, "^codex\\.")'
- 'IsMatch(log.attributes["event.name"], "^codex\\.")'
- 'IsMatch(log.body, "^codex\\.")'
- 'IsMatch(log.event_name, "^(claude_code\\.)?(api_request_body|api_response_body|system_prompt)$")'
- 'IsMatch(log.attributes["event.name"], "^(claude_code\\.)?(api_request_body|api_response_body|system_prompt)$")'
- 'IsMatch(log.body, "^claude_code\\.(api_request_body|api_response_body|system_prompt)$")'
- 'IsMatch(log.event_name, "^gen_ai\\.((system|user|assistant|tool)\\.message|choice|client\\.inference\\.operation\\.details)$")'
- 'IsMatch(log.attributes["event.name"], "^gen_ai\\.((system|user|assistant|tool)\\.message|choice|client\\.inference\\.operation\\.details)$")'
# 2. Turn running totals into per-interval amounts. Runs before step 3 so
# each series is still told apart by its original attributes.
cumulative_to_delta: {}
# 3. Keep only the attribute keys Nosphera reads; clear names, messages and
# bodies that can carry text. Any error drops the batch instead of
# sending it unfiltered.
transform/allowlist:
error_mode: propagate
trace_statements:
- context: resource
statements:
- 'keep_keys(resource.attributes, [])'
- context: scope
statements:
- 'keep_keys(scope.attributes, [])'
- context: span
statements:
- >-
keep_keys(span.attributes, ["event.name", "gen_ai.operation.name",
"openinference.span.kind", "success", "error.type", "decision_type", "duration_ms", "type",
"gen_ai.token.type", "model", "gen_ai.response.model", "gen_ai.request.model",
"llm.model_name", "llm.response.model_name", "llm.request.model_name",
"tool_name", "gen_ai.tool.name", "tool.name", "input_tokens",
"gen_ai.usage.input_tokens", "gen_ai.usage.prompt_tokens", "llm.token_count.prompt",
"output_tokens", "gen_ai.usage.output_tokens", "gen_ai.usage.completion_tokens",
"llm.token_count.completion", "cache_read_tokens",
"gen_ai.usage.cache_read.input_tokens", "gen_ai.usage.cache_read_input_tokens",
"llm.token_count.prompt_details.cache_read", "cache_creation_tokens",
"gen_ai.usage.cache_creation.input_tokens", "gen_ai.usage.cache_write.input_tokens",
"gen_ai.usage.cache_creation_input_tokens",
"llm.token_count.prompt_details.cache_write", "cost_usd_micros", "cost_usd",
"llm.cost.total", "tool", "token_type",
"gen_ai.usage.input_tokens.cache_write"])
- 'set(span.name, "span") where not IsMatch(span.name, "^claude_code\\.[a-z_.]{1,64}$")'
- 'set(span.status.message, "")'
- 'set(span.trace_state, "")'
- context: spanevent
statements:
- 'keep_keys(spanevent.attributes, [])'
metric_statements:
- context: resource
statements:
- 'keep_keys(resource.attributes, [])'
- context: scope
statements:
- 'keep_keys(scope.attributes, [])'
- context: datapoint
statements:
- >-
keep_keys(datapoint.attributes, ["event.name", "gen_ai.operation.name",
"openinference.span.kind", "success", "error.type", "decision_type", "duration_ms", "type",
"gen_ai.token.type", "model", "gen_ai.response.model", "gen_ai.request.model",
"llm.model_name", "llm.response.model_name", "llm.request.model_name",
"tool_name", "gen_ai.tool.name", "tool.name", "input_tokens",
"gen_ai.usage.input_tokens", "gen_ai.usage.prompt_tokens", "llm.token_count.prompt",
"output_tokens", "gen_ai.usage.output_tokens", "gen_ai.usage.completion_tokens",
"llm.token_count.completion", "cache_read_tokens",
"gen_ai.usage.cache_read.input_tokens", "gen_ai.usage.cache_read_input_tokens",
"llm.token_count.prompt_details.cache_read", "cache_creation_tokens",
"gen_ai.usage.cache_creation.input_tokens", "gen_ai.usage.cache_write.input_tokens",
"gen_ai.usage.cache_creation_input_tokens",
"llm.token_count.prompt_details.cache_write", "cost_usd_micros", "cost_usd",
"llm.cost.total", "tool", "token_type",
"gen_ai.usage.input_tokens.cache_write"])
log_statements:
- context: resource
statements:
- 'keep_keys(resource.attributes, [])'
- context: scope
statements:
- 'keep_keys(scope.attributes, [])'
- context: log
statements:
- >-
keep_keys(log.attributes, ["event.name", "gen_ai.operation.name",
"openinference.span.kind", "success", "error.type", "decision_type", "duration_ms", "type",
"gen_ai.token.type", "model", "gen_ai.response.model", "gen_ai.request.model",
"llm.model_name", "llm.response.model_name", "llm.request.model_name",
"tool_name", "gen_ai.tool.name", "tool.name", "input_tokens",
"gen_ai.usage.input_tokens", "gen_ai.usage.prompt_tokens", "llm.token_count.prompt",
"output_tokens", "gen_ai.usage.output_tokens", "gen_ai.usage.completion_tokens",
"llm.token_count.completion", "cache_read_tokens",
"gen_ai.usage.cache_read.input_tokens", "gen_ai.usage.cache_read_input_tokens",
"llm.token_count.prompt_details.cache_read", "cache_creation_tokens",
"gen_ai.usage.cache_creation.input_tokens", "gen_ai.usage.cache_write.input_tokens",
"gen_ai.usage.cache_creation_input_tokens",
"llm.token_count.prompt_details.cache_write", "cost_usd_micros", "cost_usd",
"llm.cost.total", "tool", "token_type",
"gen_ai.usage.input_tokens.cache_write"])
- 'set(log.body, "") where not IsMatch(log.body, "^claude_code\\.[a-z_]{1,64}$")'
# 4. At most 500 items per request (Nosphera takes up to 1,000).
batch:
send_batch_size: 500
send_batch_max_size: 500
timeout: 5s
exporters:
otlp_http: # older Collector versions call this exporter otlphttp
endpoint: https://mcp.nosphera.com/otlp
encoding: json
compression: gzip
headers:
Authorization: "Bearer ${env:NOSPHERA_TOKEN}"
service:
telemetry:
metrics:
level: none # no extra port for the Collector's own metrics
pipelines:
traces:
receivers: [otlp]
processors: [filter/content, transform/allowlist, batch]
exporters: [otlp_http]
metrics:
receivers: [otlp]
processors: [filter/content, cumulative_to_delta, transform/allowlist, batch]
exporters: [otlp_http]
logs:
receivers: [otlp]
processors: [filter/content, transform/allowlist, batch]
exporters: [otlp_http]Start the Collector with the code from step 1 in its own environment. On macOS and Linux:
export NOSPHERA_TOKEN="$(cat ~/.config/nosphera/token)"
./otelcol-contrib --config=nosphera-collector.yamlOn Windows, in PowerShell:
$env:NOSPHERA_TOKEN = (Get-Content -Raw "$env:USERPROFILE\.nosphera\token").Trim()
.\otelcol-contrib.exe --config=nosphera-collector.yamlThen point your agent at the Collector. Don't give your agent the code. These settings also keep prompts and answers out of the tracking data at the source:
export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_SPAN_LINK_COUNT_LIMIT=0
export OTEL_METRICS_EXEMPLAR_FILTER=always_off
export OPENINFERENCE_HIDE_INPUTS=true
export OPENINFERENCE_HIDE_OUTPUTS=trueAdd OpenInference instrumentation, which records the model, token and tool numbers. For LangChain and LangGraph:
pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http openinference-instrumentation-langchainfrom opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from openinference.instrumentation.langchain import LangChainInstrumentor
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)
LangChainInstrumentor().instrument(tracer_provider=provider)- CrewAI: install
openinference-instrumentation-crewaiandopeninference-instrumentation-litellm, and useCrewAIInstrumentorandLiteLLMInstrumentorthe same way. - OpenAI Agents SDK: install
openinference-instrumentation-openai-agents, useOpenAIAgentsInstrumentorthe same way, and setOPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA=false.
Get started
Create an account, connect your agent, then open your agent’s Insights tab and choose Switch on tracking. To see what the reputation tips are based on, read how to earn verified proof and how the trust score works.
Stuck? See support or email info@nosphera.com.

