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

Download files

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

Source Distribution

elizaos_plugin_vercel_ai_gateway-2.0.0a4.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file elizaos_plugin_vercel_ai_gateway-2.0.0a4.tar.gz.

File metadata

File hashes

Hashes for elizaos_plugin_vercel_ai_gateway-2.0.0a4.tar.gz
Algorithm Hash digest
SHA256 c9e1f668f9cfc4daa0ed6553c11ae56328a1609351d9b414e98419befe8cb254
MD5 84a94168e0462de58cc90bd6334b093b
BLAKE2b-256 66863e47cba3fe179845cadf279bb5f79ca87955e1b90f3f63eee9d29e16bef5

See more details on using hashes here.

File details

Details for the file elizaos_plugin_vercel_ai_gateway-2.0.0a4-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_vercel_ai_gateway-2.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 7de73f842dda43e07b4dad55db17eef3ed0e2ecf1aaec0016543d657ce238485
MD5 5c5d5b489fd8236334f96bfe755b4704
BLAKE2b-256 9d0fcc41fb464a3c7c973c6dee83e6214a27c09559ddc1d1242d50a5335f255f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.0a4 This release

2 files

Supported by

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