Skip to content

SDK shim overview

TokenOps is a transparent proxy. Every SDK shim is "set the base URL env var, run as usual." No SDK fork, no patching.

ProviderDefault base URLProxy base URL
OpenAIhttps://api.openai.comhttp://127.0.0.1:7878/openai/v1
Anthropichttps://api.anthropic.comhttp://127.0.0.1:7878/anthropic
Geminihttps://generativelanguage.googleapis.comhttp://127.0.0.1:7878/gemini

Per-SDK setup:

Auth passthrough

The proxy strips hop-by-hop headers (RFC 7230) and forwards everything else, so provider auth headers reach upstream unchanged:

ProviderHeader(s)
OpenAIAuthorization: Bearer <key>
Anthropicx-api-key, anthropic-version
Geminix-goog-api-key or Authorization: Bearer <jwt>

The proxy never logs auth values; integration tests in internal/proxy/sdkshim_test.go assert the original headers reach the upstream verbatim.

Attribution headers

Tag each request so TokenOps can stitch related calls into workflows and sessions:

HeaderPurpose
X-Tokenops-Workflow-Idgroups multi-step pipelines
X-Tokenops-Agent-Ididentifies the agent emitting
X-Tokenops-Session-Idgroups conversation turns
X-Tokenops-User-Idend-user attribution

Attribution headers flow through the SDK shim path unchanged.

Apache 2.0 licensed.