You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Push Claude Code subscription metrics to the gateway OTLP endpoint #741
When infer runs with a Claude Code Max subscription, traffic goes infer CLI -> Claude Code -> Anthropic API and bypasses the gateway entirely, so no metrics are recorded. The CLI should parse Claude Code headless-mode logs and push usage/tool-call metrics to the gateway:
Push OTLP JSON (or protobuf) to POST {gateway}/v1/metrics with Content-Type: application/json, delta temporality.
Supported metrics: gen_ai.client.token.usage (delta sum per operation, with gen_ai.token.type = input|output), gen_ai.client.operation.duration, gen_ai.client.operation.time_to_first_chunk, gen_ai.execute_tool.duration (histograms, seconds; carry error.type on failures so tool success/failure is derivable), inference_gateway.tool_calls (delta monotonic sum).
Attributes: gen_ai.provider.name, gen_ai.request.model, gen_ai.tool.name, gen_ai.tool.type, error.type, and set source to claude-code-subscription so subscription clients are labeled distinctly (anything else is dropped by the gateway's allowlist; source="gateway" is rewritten server-side).
Forward the user's bearer token when the gateway runs with auth enabled; handle 403 (push disabled) gracefully.
Example payload: see "Pushing metrics (OTLP)" in the gateway's examples/docker-compose/monitoring/README.md.
Acceptance Criteria
infer parses Claude Code headless-mode logs for token usage and tool-call outcomes
Metrics are pushed to the gateway's POST /v1/metrics endpoint with source=claude-code-subscription
Push failures (endpoint disabled, auth, network) degrade gracefully without breaking the session
Activity
feat: improve Claude Code headless integration with streaming events (#…
chore(release): 0.132.0 [skip ci]