Helicone (tracing)
Helicone’s Manual Logger records calls to custom, self-hosted, and provider-backed models. The Respan Helicone instrumentation observes that same manual-logger lifecycle and emits canonical Respan spans without replacing or bypassing Helicone’s own logging.
The integration supports helicone-helpers >=1.2.1,<1.3.0 for Python and @helicone/helpers >=1.8.3 <1.9.0 for TypeScript.
Set up Respan
Create an account at platform.respan.ai and grab an API key .
Paste this into your coding agent:
Help me set up Respan tracing with the Helicone integration.
Follow https://www.respan.ai/docs/integrations/helicone.mdSetup
Install packages
pip install respan-ai respan-instrumentation-helicone "helicone-helpers~=1.2.1" openaiSet environment variables
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
export HELICONE_API_KEY="YOUR_HELICONE_API_KEY"
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"RESPAN_API_KEY exports traces to Respan. HELICONE_API_KEY keeps the Manual Logger connected to Helicone. This example calls OpenAI directly, so it also needs OPENAI_API_KEY; use the credential required by the provider in your callback. RESPAN_BASE_URL is optional for a self-hosted or non-default Respan endpoint.
Initialize and run
Initialize Respan before the first Helicone Manual Logger call.
import os
from helicone_helpers import HeliconeManualLogger
from openai import OpenAI
from respan import Respan
from respan_instrumentation_helicone import HeliconeInstrumentor
respan = Respan(
api_key=os.environ["RESPAN_API_KEY"],
app_name="helicone-manual-logger",
instrumentations=[HeliconeInstrumentor()],
)
helicone = HeliconeManualLogger(api_key=os.environ["HELICONE_API_KEY"])
openai = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
request = {
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say hello in three languages."}],
}
def call_model(recorder):
response = openai.chat.completions.create(**request)
recorder.append_results(response.model_dump())
return response
try:
response = helicone.log_request(
request=request,
operation=call_model,
provider="openai",
additional_headers={
"Helicone-User-Id": "user_123",
"Helicone-Session-Id": "conversation_456",
"Helicone-Property-Environment": "production",
},
)
print(response.choices[0].message.content)
finally:
respan.flush()
respan.shutdown()View your trace
Open the Traces page to inspect the Helicone span’s model, provider, input, output, usage, status, timing, and correlation attributes.
What is traced
The instrumentors patch Helicone’s published Manual Logger methods rather than the underlying provider SDK.
| Language | Manual Logger surface |
|---|---|
| Python | log_request(), direct send_log(), log_builder(), and the builder’s async send_log() lifecycle |
| TypeScript | logRequest(), logStream(), logSingleStream(), logSingleRequest(), direct sendLog(), and HeliconeLogBuilder |
The emitted span type is inferred from the payload:
| Helicone payload | Respan log type |
|---|---|
| Chat messages, including OpenAI-, Anthropic-, and Google-shaped content | chat |
| Prompt and text completion | text |
| Embedding input and vectors | embedding |
_type=tool custom event | tool |
_type=vector_db custom event | task |
_type=data custom event | task |
When Helicone supplies them, Respan retains model and provider identity, request and response content, token usage, tool definitions and calls, streaming timing, HTTP status, and errors. An operation that fails before Helicone reaches its shared logging sink still produces one error span rather than a duplicate success/error pair.
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key / apiKey | str | None / string | undefined | RESPAN_API_KEY | Respan API key used to export traces. |
base_url / baseURL | str | None / string | undefined | RESPAN_BASE_URL | Optional Respan trace export endpoint. |
instrumentations | list / RespanInstrumentation[] | [] | Include HeliconeInstrumentor() or new HeliconeInstrumentor() to activate tracing. |
capture_content | bool | True | Python option that controls request and response content capture. |
traceContent | boolean | true | TypeScript option that controls request and response content capture. |
Disable content capture
Disable content capture when prompts or responses may contain sensitive data:
from respan_instrumentation_helicone import HeliconeInstrumentor
instrumentor = HeliconeInstrumentor(capture_content=False)Model, provider, usage, timing, status, errors, and safe correlation fields remain available. Helicone API keys, authorization headers, unknown headers, and structured secret fields are never copied into spans.
Correlation attributes
The instrumentors recognize Helicone’s safe correlation headers:
| Header | Respan behavior |
|---|---|
Helicone-User-Id | Sets the customer identifier. |
Helicone-Session-Id | Sets the session or conversation identifier. |
Helicone-Property-* | Preserved as safe association properties or Helicone metadata. |
Respan propagated attributes also stay attached to the manual-log span, including parent workflow context captured when a delayed builder is created.
Avoid duplicate telemetry
Helicone instrumentation is explicit-only. Activate it only in processes that use HeliconeManualLogger.
Do not also activate a provider-specific instrumentor for the same provider call unless two spans for one logical operation are intentional. Likewise, a request routed through Respan Gateway already creates a gateway log; wrapping it in an instrumented Helicone manual log adds a separate manual-log span. See the gateway guide for the simpler gateway-only migration path.