Guides

Provider Configuration

Overview

Pay-i supports various GenAI Providers that offer capabilities beyond just language models. The table below provides an overview of the supported providers:

ProviderIntegration TypeDetailed Documentation
OpenAIAuto-InstrumentedOpenAI Configuration
Azure OpenAIAuto-InstrumentedAzure OpenAI Configuration
AnthropicAuto-InstrumentedAnthropic Configuration
AWS BedrockAuto-InstrumentedAWS Bedrock Configuration
LangChainCallback HandlerLangChain Configuration

The first four providers (OpenAI, Azure OpenAI, Anthropic, and AWS Bedrock) are directly instrumented by the payi_instrument() function, which patches their API calls automatically.

LangChain uses a different approach with a custom callback handler that captures usage information after calls complete, rather than being directly instrumented.

These providers support a range of GenAI capabilities including:

  • Text Generation & Chat: Generate coherent text and hold interactive conversations
  • Embeddings: Create vector representations of text for semantic similarity and search
  • Knowledge Retrieval: Retrieve and use information from external sources (including RAG implementations)
  • Image Generation: Create images from text descriptions
  • Vision & Image Analysis: Process and analyze image content
  • Speech Processing: Convert between text and speech
  • Multimodal Processing: Work with multiple types of data (text, images, audio) simultaneously

For a complete and up-to-date list of all supported models and Resources for each Provider, refer to the Pay-i Managed Categories and Resources documentation.

Auto-Instrumentation Overview

Pay-i's Python SDK provides automatic instrumentation for these providers through the payi_instrument() function. When enabled, the SDK intercepts API calls to the providers and tracks usage metrics without requiring code changes to your application's core logic.

To enable auto-instrumentation for any of the supported providers:

from payi.lib.instrument import payi_instrument

# Enable instrumentation for all supported providers
payi_instrument()

# Enable instrumentation for specific providers only
payi_instrument(instruments={"openai", "anthropic"})

Refer to the provider-specific configuration pages linked in the table above for detailed instructions on configuring each provider, including:

  • Required dependencies
  • SDK version compatibility
  • Model-specific configuration
  • Special features or limitations
  • Code examples

Custom Provider Configuration

If you need to work with a provider that isn't directly supported by Pay-i's auto-instrumentation, you can:

  1. Use the REST Ingest API or Python SDK Ingest API to explicitly submit usage data
  2. Define Custom Categories and Resources to track your custom provider's usage

Related Documentation