Skip to main content
Chimeric Logo

Chimeric

PyPI version Python Versions License: MIT Documentation Status CI codecov

Unified Python interface for multiple LLM providers with automatic provider detection and seamless switching.

🚀 Supported Providers

OpenAI Anthropic Google AI xAI Grok Groq Cohere Cerebras OpenRouter

📖 Documentation

For detailed usage examples, configuration options, and advanced features, visit our documentation.

📦 Installation

pip install chimeric

Set your API keys as environment variables:

export OPENAI_API_KEY="your-key-here"
export ANTHROPIC_API_KEY="your-key-here"

⚡ Quickstart

Basic Usage

from chimeric import Chimeric

client = Chimeric()  # Auto-detects API keys from environment

response = client.generate(
    model="gpt-4o",
    messages="Hello!"
)
print(response.content)

Streaming Responses

# Real-time streaming
stream = client.generate(
    model="claude-3-5-sonnet-latest",
    messages="Tell me a story about space exploration",
    stream=True
)

for chunk in stream:
    print(chunk.content, end="", flush=True)

Function Calling with Tools

@client.tool()
def get_weather(city: str) -> str:
    """Get current weather for a city."""
    return f"Sunny, 72°F in {city}"

@client.tool()
def calculate_tip(bill_amount: float, tip_percentage: float = 18.0) -> dict:
    """Calculate tip and total amount for a restaurant bill."""
    tip = bill_amount * (tip_percentage / 100)
    total = bill_amount + tip
    return {"tip": tip, "total": total, "tip_percentage": tip_percentage}

response = client.generate(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "What's the weather in NYC?"},
        {"role": "user", "content": "Also calculate a tip for a $50 dinner bill"}
    ]
)
print(response.content)

Structured Output

from pydantic import BaseModel

class Sentiment(BaseModel):
    label: str
    score: float
    reasoning: str

response = client.generate(
    model="gpt-4o",
    messages="Analyse the sentiment: 'This library is fantastic!'",
    response_model=Sentiment,
)
print(response.parsed.label)    # "positive"
print(response.parsed.score)    # 0.98

Embeddings

# Single text → result.embedding (list[float])
result = client.embed(
    model="text-embedding-3-small",
    input="Python developer with 5 years experience",
)
print(len(result.embedding))   # e.g. 1536

# Batch → result.embeddings (list[list[float]])
result = client.embed(
    model="text-embedding-3-small",
    input=["Python developer", "Go engineer", "React developer"],
)
print(len(result.embeddings))  # 3

# Also available via Google and Cohere
result = client.embed(model="gemini-embedding-001", input="Hello")
result = client.embed(model="embed-english-v3.0", input="Hello")

Multi-Provider Switching

# Seamlessly switch between providers
models = ["gpt-4o-mini", "claude-3-5-haiku-latest", "gemini-2.5-flash"]

for model in models:
    response = client.generate(
        model=model,
        messages="Explain quantum computing in one sentence"
    )
    print(f"{model}: {response.content}")

🔧 Key Features

  • Multi-Provider Support: Switch between 8 major AI providers seamlessly
  • Automatic Detection: Auto-detects available API keys from environment
  • Unified Interface: Consistent API across all providers
  • Embeddings: Single and batch text embeddings via OpenAI, Google, and Cohere
  • Structured Output: Parse responses directly into Pydantic models
  • Streaming Support: Real-time response streaming
  • Function Calling: Tool integration with decorators
  • Async Support: Full async/await compatibility
  • Local AI: Connect to Ollama, LM Studio, or any OpenAI-compatible endpoint

🐛 Issues & Feature Requests

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for chimeric 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chimeric 0.3.0
File Size Uploaded
chimeric-0.3.0.tar.gz 4.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for chimeric 0.3.0
File Interpreter ABI Platform
chimeric-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.2 MB

Release files / chimeric-0.3.0.tar.gz

Download URL chimeric-0.3.0.tar.gz
Size 4.1 MB
Tags Source
SHA-256 checksum
How to use checksums
872f6053441260e0f24fe9077fab3c866e46d2af54f77ed3a7b16442e39358d4
BLAKE2b-256 checksum
How to use checksums
93a08fcce2d4c817523aea126230d2bd5d5352df045fa7ce2f435ed9c36a4106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 21, 2026.

Transparency log

Release files / chimeric-0.3.0-py3-none-any.whl

Download URL chimeric-0.3.0-py3-none-any.whl
Size 41.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c0ee409b1c32c15b4d0274a22cbad5f53009a0c9df976966e70d722543e55c9
BLAKE2b-256 checksum
How to use checksums
6a5cb29177f42b3c05e52e6c333b0570efc59d63cbee7f66b9a4404bc60ff126
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page