Quick Start
What Gets Traced
The instrumentor captures gateway-routed SDK calls the same way it captures direct provider calls:- Chat completions - Inputs, outputs, and token usage
- Tool / function calls - Arguments and results for each tool invocation
- Streaming responses - Streamed completions with aggregated tokens
Authenticated Gateway
If the gateway requires Cloudflare authentication, send the token incf-aig-authorization and keep the provider key as api_key:
api_key to the Cloudflare token instead:
Unified REST API
Cloudflare also exposes OpenAI-compatible endpoints onapi.cloudflare.com. That client is still the OpenAI SDK, so the same instrumentor traces it. Model names use author/model (for example openai/gpt-4.1-mini), and the Cloudflare API token is api_key:
cf-aig-gateway-id targets a specific gateway. Omit it for third-party models to use the account default. Workers AI models require the header.
See Cloudflare’s REST API for the current model catalog and /ai/v1/responses usage. Either base URL traces the same way, so if you already call OpenAI through gateway.ai.cloudflare.com, keep that base_url.
Other Provider SDKs
HoneyHive patches the SDK you import, not the host. For a provider SDK that accepts a custom base URL:- Install the extra from that SDK’s integration page
- Call its instrumentor with
tracer_provider=tracer.provider - Point the SDK
base_url(or equivalent, such ashttp_options.base_url) at Cloudflare’s provider URL. The{provider}segment and any extra path pieces live on Cloudflare’s provider pages. Authenticated gateways still sendcf-aig-authorization.
Do not re-point a boto3 Bedrock client at the gateway. Bedrock uses SigV4, so a
base_url / endpoint_url swap fails. Use the unified REST API with the OpenAI SDK (aws-bedrock/...), or follow Cloudflare’s Bedrock provider page for the signed request shape.
Cloudflare also proxies Groq, DeepSeek, Mistral, xAI, OpenRouter, and other OpenAI-compatible APIs. Keep OpenAIInstrumentor and the OpenAI SDK. Change base_url to that provider’s Cloudflare path. A vendor package that is not openai (for example a Groq-only SDK) is not patched.
If HoneyHive has no instrumentor for that SDK, use the unified REST API with the OpenAI SDK, or LiteLLM if you already route calls through LiteLLM. Raw fetch / curl is not autotraced.
Environment Configuration
Troubleshooting
Traces not appearing
- Check the instrumentor - Call the instrumentor for the SDK you import, with
tracer_provider=tracer.provider, before creating the client or making requests - Confirm you use a provider SDK - HoneyHive traces SDK methods. Raw
fetch/curlto the gateway is not autotraced - Check
HH_API_KEY- Use a project API key from Settings → Project → API Keys
Requests fail at the gateway
- Account and gateway IDs - Both path segments must match a gateway in the Cloudflare dashboard
- Authenticated gateway - Provider-specific URLs on
gateway.ai.cloudflare.comusecf-aig-authorization, notAuthorization, for the Cloudflare token - Model name - Provider-specific OpenAI URLs use OpenAI model IDs (
gpt-4o-mini). The unified REST API usesauthor/modelfor third-party models and@cf/author/modelfor Workers AI /ai/runis not autotraced - That envelope endpoint is not a provider SDK. Use/ai/v1/chat/completionsor a provider-native SDK URL if you want HoneyHive to capture the call- Cache hits - HoneyHive records the completion the SDK receives. A gateway cache hit still returns a completion body, so the span still has inputs, outputs, and any
usageon that body. The instrumentor does not capture Cloudflare headers such ascf-aig-cache-status. Add that withenrich_spanif you need it.
Related
Integrations Overview
Provider SDK instrumentors to pair with a gateway base_url
OpenAI Integration
OpenAIInstrumentor used in the Quick Start
Portkey
Another OpenAI-compatible gateway traced the same way
Custom Spans
Create spans for business logic around API calls
Enrich Your Traces
Add user IDs and custom metadata to traces