For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK Setup

Use SDK Setup when you are instrumenting an application directly with Revenium SDKs, middleware, API keys, and integration identifiers. Start here if you are adding metering to code you own.

What You Need

  • A Revenium API key with the right scope for your integration.

  • Your tenant, team, and environment identifiers.

  • The API base URL for your workspace.

  • A choice of integration path: SDK, middleware, OTLP, MCP, Revvy CLI, or direct API.

  1. Review API Key Permissions before creating production keys.

  2. Choose an implementation path from Integration Options.

  3. Use Provider Integrations for billing-provider account connections.

  4. Use OTLP Integration if your stack already emits OpenTelemetry.

Python SDK

Install only the providers you need:

Provider
Install command

OpenAI or Azure OpenAI

pip install "revenium-python-sdk[openai]"

Anthropic or Anthropic via Bedrock

pip install "revenium-python-sdk[anthropic]"

Google Gemini

pip install "revenium-python-sdk[google-genai]"

Google Vertex AI

pip install "revenium-python-sdk[google-vertex]"

LiteLLM

pip install "revenium-python-sdk[litellm]"

LiteLLM Proxy

pip install "revenium-python-sdk[litellm-proxy]"

Ollama

pip install "revenium-python-sdk[ollama]"

Perplexity

pip install "revenium-python-sdk[perplexity-openai]"

Fal.ai

pip install "revenium-python-sdk[fal]"

LangChain

pip install "revenium-python-sdk[langchain]"

You can install multiple extras together, for example:

Node.js Middleware

Use the unified middleware package and provider sub-paths:

Provider
Package

OpenAI / Azure OpenAI

@revenium/middleware/openai

Anthropic

@revenium/middleware/anthropic

Google Vertex AI

@revenium/middleware/google/vertex

Google AI SDK

@revenium/middleware/google/genai

Perplexity

@revenium/middleware/perplexity

LiteLLM

@revenium/middleware/litellm

Install from npm:

Go SDK

Install:

Minimal OpenAI wrapper:

Frameworks and Agent Tooling

Framework or tool
Start here

LangChain

Use the Python langchain extra, or use OTLP Integration if your app already emits OpenTelemetry.

n8n

Use the Revenium n8n middleware packages for OpenAI or Anthropic agents.

OpenInference / OpenLLMetry

Claude Code, Gemini CLI, Cursor, and other AI coding tools

Use Context7 and AI Docs Access, MCP Server, or Revvy CLI depending on the workflow.

JetBrains IDEs (IntelliJ, PyCharm, GoLand, etc.)

Use Revvy CLI for guided instrumentation — scans your codebase, finds AI call sites, and walks through SDK setup.

Usage Metadata

SDKs accept optional usage metadata for billing, attribution, and alerting. The fields accepted on POST /meter/v2/ai/completions are:

Field
Purpose

organizationName

Top-level customer account. Required — the legacy organizationId alias is silently dropped.

productName

Commercial tier or SKU. Required — the legacy productId alias is silently dropped.

subscriber

Object: { id, email, credential: { name, value } } — the end customer plus their specific API key.

agent

Agent name making the call; powers per-agent cost views and the Tool Registry.

traceId

Links sequential AI calls into a single execution path for Trace Analytics.

taskType

Categorises the work the agent was doing (qualification, support, code review, etc.).

subscriptionId

The Revenium subscription this call rates against.

responseQualityScore

0.0–1.0 evaluation score from RAGAS, LLM-as-judge, human review, or other quality signals.

At minimum, pass organizationName + productName + subscriber.id. Add agent and traceId to unlock agent-level cost views and Trace Analytics. The remaining fields are optional.

For OpenTelemetry attribution, see the revenium.* attributes in OTLP Integration.

Last updated

Was this helpful?