Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

elizaOS Vercel AI Gateway Plugin (Python)

Python implementation of the Vercel AI Gateway plugin for elizaOS.

Features

  • Text Generation: TEXT_SMALL, TEXT_LARGE chat completions
  • Embeddings: Vector embeddings generation
  • Images: Image generation and description
  • Structured Output: JSON object generation
  • Streaming: Real-time streaming support

Installation

pip install elizaos-plugin-gateway

Quick Start

import asyncio
from elizaos_plugin_gateway import GatewayPlugin

async def main():
    async with GatewayPlugin() as plugin:
        # Text generation
        response = await plugin.generate_text_large("What is quantum computing?")
        print(response)

        # Embeddings
        embedding = await plugin.create_embedding("Hello, world!")
        print(f"Embedding dimensions: {len(embedding)}")

asyncio.run(main())

Configuration

Set environment variables:

# Required - one of:
export AI_GATEWAY_API_KEY="your-api-key"
export AIGATEWAY_API_KEY="your-api-key"
export VERCEL_OIDC_TOKEN="your-oidc-token"

# Optional
export AI_GATEWAY_BASE_URL="https://ai-gateway.vercel.sh/v1"
export AI_GATEWAY_SMALL_MODEL="gpt-5-mini"
export AI_GATEWAY_LARGE_MODEL="gpt-5"
export AI_GATEWAY_EMBEDDING_MODEL="text-embedding-3-small"

elizaOS Integration

from elizaos_plugin_gateway import get_gateway_plugin

# Get the singleton plugin instance
plugin = get_gateway_plugin()

# Use with AgentRuntime
runtime = AgentRuntime(plugins=[plugin])

API Reference

GatewayPlugin

Text Generation

await plugin.generate_text_small(prompt, system=None, max_tokens=None)
await plugin.generate_text_large(prompt, system=None, max_tokens=None)
await plugin.stream_text(prompt, model=None, system=None)

Embeddings

await plugin.create_embedding(text)

Images

await plugin.generate_image(prompt, n=1, size="1024x1024", quality="standard", style="vivid")
await plugin.describe_image(image_url, prompt=None, max_tokens=8192)

Structured Output

await plugin.generate_object(prompt, model=None, temperature=None)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy elizaos_plugin_gateway

# Linting
ruff check .
ruff format .

License

MIT

Metadata

Release files for elizaos-plugin-gateway 2.0.0a5

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

Source distribution (sdist)

Source distribution for elizaos-plugin-gateway 2.0.0a5
File Size Uploaded
elizaos_plugin_gateway-2.0.0a5.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elizaos-plugin-gateway 2.0.0a5
File Interpreter ABI Platform
elizaos_plugin_gateway-2.0.0a5-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / elizaos_plugin_gateway-2.0.0a5.tar.gz

Download URL elizaos_plugin_gateway-2.0.0a5.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
664d6542df9179b3e249996bc339e5f1a63020abad288be28530a7ba93b90237
BLAKE2b-256 checksum
How to use checksums
782bd1a13cc9bb1a3bc50d398cf40e0dcc742c004c211d70628ea4718c46d77e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / elizaos_plugin_gateway-2.0.0a5-py3-none-any.whl

Download URL elizaos_plugin_gateway-2.0.0a5-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
377c66429d232f24cc09d59aead187133e9b38d718163aaca09d4c32f13628fc
BLAKE2b-256 checksum
How to use checksums
dc669ab86834aa170f8f2c6354eaff66ea6cd8c259c62ce12f12b751329e4519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

2.0.0a5 This release

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