Skip to main content
If you’re reselling capacity from a foundation-model API and you want to charge per call in USDC, the model adapters are the shortest path. Each one wraps the official SDK and forwards the call only after payment is verified.

Available adapters

ProviderWrapsSource
OpenAI (and OpenAI-compatible)The openai SDKopenai
Anthropic ClaudeThe anthropic SDKclaude
Google Geminigoogle-generativeaigemini
CohereThe cohere ClientV2cohere
Mistralmistralaimistral
Amazon BedrockThe Bedrock Converse APIbedrock
xAI GrokThe xai-sdkxai
All seven adapters share the same API surface. If you switch from OpenAI to Claude you change one import, not your billing.

Common shape

from algovoi_openai import AlgoVoiOpenAI  # or AlgoVoiClaude, AlgoVoiGemini, etc.

adapter = AlgoVoiOpenAI(
    api_base="https://api1.ilovechicken.co.uk",
    api_key="algv_…",
    tenant_id="…",
    webhook_secret="algvw_…",
    upstream_api_key="sk-…",  # the OpenAI / Anthropic / etc. key
)

# Same interface as the upstream SDK, plus a payment check
response = await adapter.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "..."}],
    resource_id="gpt-4o-call",  # which AlgoVoi resource to charge against
)
If resource_id doesn’t have a paid Payment Credential available on the request, the call returns an HTTP 402 with the challenge JSON. The client pays, retries, and the call forwards to OpenAI.

When to use these vs the framework adapters

  • Use model adapters when you’re calling the foundation-model SDK directly and want a paywall in front of it.
  • Use framework adapters when you’re building agents or chains in LangChain, LangGraph, CrewAI, etc. The framework wraps the model call and the framework adapter wraps the framework.

See also