Skip to Content

How do I switch from Helicone to Rius for tracing the Anthropic API?

Rius traces the Anthropic API from inside your process, so you switch by calling init, comparing both tools on the same calls, and then pointing the Anthropic client back at its default base URL. Each messages.create call then appears as a span with the model, token counts and cost. You can keep the Helicone gateway in place while you compare the two. The full walkthrough is in Migrate from Helicone, part of Migrate to Rius.

How it works

Helicone is mainly a proxy. Your Anthropic client sends requests through a Helicone base URL with a Helicone-Auth header, and Helicone logs each call on the way through. Rius works differently. The Rius SDK instruments the Anthropic client library inside your process and exports spans, so nothing sits between your code and Anthropic.

  • init() turns the Anthropic integration on when its instrumentation is installed. In Python the anthropic extra installs the instrumentation, not the anthropic package itself. In TypeScript you install the instrumentation package next to the SDK.
  • The SDK exports spans in the background, so your calls do not wait on Rius.
  • The integration patches the client library, not the network path. Calls are traced whatever base URL the client uses, so you can keep the Helicone gateway while you evaluate. See the integrations list for the other libraries and frameworks.
  • If you use Helicone’s async logger instead of the proxy, replace it rather than running both in one process. Both register the process-wide OpenTelemetry tracer provider, OpenTelemetry keeps only the first registration, and the instrumented calls reach only one of the two tools.

Set it up

  1. Install the SDK with the Anthropic integration and set your Rius API key.

    pip install "glassflow-rius[anthropic]" anthropic export RIUS_API_KEY="ri_..."

    In TypeScript, install the SDK and the Anthropic instrumentation package. It must be version 0.2.7 or newer, because earlier versions undercount cost on calls that use prompt caching.

    npm install @glassflow-ai/rius @opentelemetry/api @arizeai/openinference-instrumentation-anthropic export RIUS_API_KEY="ri_..."
  2. Call init() at startup and leave the Helicone client as it is for now. The integration patches the client library, so calls through the Helicone base URL are traced too, and Helicone and Rius log the same traffic while you compare.

    # During side by side: Helicone proxy kept, traced by Rius import os import rius from anthropic import Anthropic rius.init(service_name="my-agent") # reads RIUS_API_KEY anthropic_client = Anthropic( base_url="https://anthropic.helicone.ai", default_headers={"Helicone-Auth": f"Bearer {os.environ['HELICONE_API_KEY']}"}, )
  3. In TypeScript, wait for the instrumentation to attach before your first call.

    import { init } from '@glassflow-ai/rius' import Anthropic from '@anthropic-ai/sdk' const rius = init({ serviceName: 'my-agent' }) // reads RIUS_API_KEY await rius.ready // wait until instrumentation is attached before the first call const anthropic = new Anthropic({ baseURL: 'https://anthropic.helicone.ai', defaultHeaders: { 'Helicone-Auth': `Bearer ${process.env.HELICONE_API_KEY}` }, })

    In a CommonJS app, require @anthropic-ai/sdk before init(), or the calls stay untraced. Details are on the Anthropic integration page.

  4. Move your Helicone headers onto Rius. A session id replaces Helicone-Session-Id, a user id replaces Helicone-User-Id, and span attributes replace Helicone-Property-*.

    with rius.session(session_id): with rius.user(request.user_id): with rius.start_as_current_span("support_ticket") as span: span.set_attribute("app.ticket_id", ticket_id) response = anthropic_client.messages.create(...)
  5. Run one call and open the trace in the console. Check the model, the token counts and the cost. While the Helicone base URL is in place, use plain model names such as claude-haiku-4-5-20251001, not a gateway-style name, or calls show tokens but no cost. Compare request counts, token totals and cost in both tools for a few days.

  6. When the numbers match your needs, point the client back at Anthropic, remove the Helicone-* headers, and revoke the Helicone key once nothing sends to it.

    # After cutover: direct to the provider, traced by Rius anthropic_client = Anthropic() # default base URL, ANTHROPIC_API_KEY

    If you use Helicone-managed provider keys or credits, switch to your own Anthropic key first, because Rius never holds provider keys.

What you get

  • One span per call. Each messages.create call becomes a span carrying the model, input and output tokens including cache reads and writes, and the request and response messages.
  • Cost per call. Rius computes cost from the model and token counts. It is a list-price estimate in US dollars, and you never send a cost value.
  • The system prompt in place. Anthropic takes it as a separate parameter, and Rius shows it as the leading system message of the input.
  • Errors by class. A failed call records the error class, such as anthropic.NotFoundError.
  • Streaming usage. Token usage is captured on streamed calls. Auto-instrumented Anthropic streams carry no time to first token, which the Anthropic page explains.
  • Run structure. Wrap your function in observe and the model call nests inside your agent’s run. Sessions and users show on the trace and on the Users page.
  • Side-by-side numbers. With the gateway kept, a response Helicone serves from its cache still appears in Rius as a call priced from its tokens. Rius cost therefore runs higher than Helicone’s by your cache-hit share.

When something else fits

  • If caching, rate limits, retries or fallbacks are load-bearing, keep the Helicone gateway and add Rius next to it. Rius is not a gateway and does not offer those features.
  • Prompt management, scores, datasets and evals are not part of Rius, and existing Helicone history is not imported. Keep those workflows and past data where they are, and start Rius traces from the cutover.

Still stuck? Get help

Last updated on