Skip to main content

Anannas AI LLM integration for Pipecat - Access 500+ models through a unified gateway

Project description

Anannas AI Integration for Pipecat

An OpenAI-compatible LLM service integration for Pipecat that provides access to 500+ models through Anannas AI's unified gateway.

About Anannas AI

Anannas AI is a unified inference gateway that provides access to 500+ models from OpenAI, Anthropic, Mistral, Gemini, DeepSeek, and other providers through a single OpenAI-compatible API. Key features include:

  • Unified API: Access 500+ models through one consistent interface
  • Built-in Observability: Cache hit rate analytics, token-level metrics, tool/function call analytics, and model efficiency scoring
  • Smart Routing: Automatic provider health monitoring and failover with ~0.48ms overhead
  • Cost Optimization: 5% markup with transparent pricing
  • Enterprise Ready: BYOK (Bring Your Own Key) support for secure deployments
  • Production Proven: Powering deployments with 100k+ requests and 100M+ tokens processed

Installation

Install the package from PyPI:

pip install pipecat-anannas

Or install from source:

git clone https://github.com/upsurgeio/anannas-pipecat-integration.git
cd anannas-pipecat-integration
pip install -e .

Quick Start

import os
from pipecat_anannas import AnannasLLMService
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineTask

# Initialize Anannas LLM service
llm = AnannasLLMService(
    api_key=os.getenv("ANANNAS_API_KEY"),
    model="gpt-4o"  # or any supported model
)

# Use in your Pipecat pipeline
pipeline = Pipeline([
    # ... your pipeline components
    llm,
    # ... more components
])

Supported Models

Anannas AI provides access to models from multiple providers:

  • OpenAI: gpt-4o, gpt-4-turbo, gpt-3.5-turbo, and more
  • Anthropic: claude-3-5-sonnet-20241022, claude-3-opus, claude-3-sonnet
  • Mistral: mistral-large, mistral-medium, mistral-small
  • Google: gemini-pro, gemini-1.5-pro
  • DeepSeek: deepseek-chat, deepseek-coder
  • And 500+ more models...

Usage with Pipecat Pipeline

Basic Example

import os
from dotenv import load_dotenv

from pipecat_anannas import AnannasLLMService
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineTask
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.azure.tts import AzureTTSService

load_dotenv()

# Create services
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
llm = AnannasLLMService(api_key=os.getenv("ANANNAS_API_KEY"), model="gpt-4o")
tts = AzureTTSService(
    api_key=os.getenv("AZURE_SPEECH_API_KEY"),
    region=os.getenv("AZURE_SPEECH_REGION")
)

# Build pipeline
pipeline = Pipeline([stt, llm, tts])
task = PipelineTask(pipeline)

Function Calling Example

See the complete function calling example in examples/function_calling_example.py. This demonstrates:

  • Setting up Anannas LLM service
  • Registering function handlers
  • Using function calling in a voice conversation
  • Streaming responses

To run the example:

# Set required environment variables
export ANANNAS_API_KEY=your_api_key
export DEEPGRAM_API_KEY=your_deepgram_key
export AZURE_SPEECH_API_KEY=your_azure_key
export AZURE_SPEECH_REGION=your_azure_region

# Run the example
python examples/function_calling_example.py

Configuration

Environment Variables

  • ANANNAS_API_KEY: Your Anannas AI API key (required)

Service Parameters

AnannasLLMService(
    api_key: Optional[str] = None,  # API key or use ANANNAS_API_KEY env var
    model: str = "gpt-4o",           # Model to use
    base_url: str = "https://api.anannas.ai/v1",  # API endpoint
    **kwargs                          # Additional OpenAI-compatible parameters
)

Observability

Anannas AI provides built-in observability through its dashboard:

  • Cache Analytics: Monitor cache hit rates to optimize costs
  • Token Metrics: Track token usage across models and requests
  • Function Call Analytics: Analyze tool/function call patterns
  • Model Efficiency: Compare performance across different models
  • Provider Health: Real-time monitoring of provider availability

Access your dashboard at: https://anannas.ai/dashboard

Enterprise Features

BYOK (Bring Your Own Key)

For enterprise deployments requiring direct API keys to providers:

  • Use your own OpenAI, Anthropic, or other provider API keys
  • Maintain full control over credentials
  • Transparent cost tracking

Learn more: https://docs.anannas.ai/UseCases/BYOK

Pipecat Compatibility

Tested with Pipecat: v0.0.86+

This integration extends OpenAILLMService and is compatible with all Pipecat features:

  • ✅ Streaming responses
  • ✅ Function calling / tool use
  • ✅ Context management
  • ✅ Multi-modal support
  • ✅ Interruption handling

Development

Setting Up for Development

git clone https://github.com/upsurgeio/anannas-pipecat-integration.git
cd anannas-pipecat-integration
pip install -e ".[dev]"

Running Tests

pytest tests/

Links

Support

Maintainer

This integration is maintained by the Anannas AI team. We're committed to keeping this integration up-to-date with the latest Pipecat releases and providing ongoing support.

License

BSD 2-Clause License - see LICENSE file for details.

This license is compatible with Pipecat's BSD 2-Clause License, ensuring seamless integration.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Changelog

See CHANGELOG.md for version history and updates.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipecat_anannas-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipecat_anannas-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pipecat_anannas-0.1.0.tar.gz.

File metadata

  • Download URL: pipecat_anannas-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pipecat_anannas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 91705bfa0b37f5c4cae408d3314dff60d933fd0265bc8e288a16a3a789e6a58d
MD5 6fdf9c4a5b04c00f71a8ea9a5583fecb
BLAKE2b-256 6c17e32da84a99ee62a7027ff90065a48764faf7d50c3f655023a6d053f22d2e

See more details on using hashes here.

File details

Details for the file pipecat_anannas-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pipecat_anannas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a982eb04e5a8d288e4bd01bcbf45d8846c632e86913de0d899d88b25dd1db40
MD5 72049338c26217f1d693f7f8bc9d4b78
BLAKE2b-256 b74a055fc3be4f2d863fc419538639b1d95cabbd532d92e6bc4286ae2c2872f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page