Skip to main content

elizaOS Vercel AI Gateway Plugin - AI Gateway integration for text, embeddings, and images

Project description

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

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

elizaos_plugin_gateway-2.0.0a5.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.

elizaos_plugin_gateway-2.0.0a5-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file elizaos_plugin_gateway-2.0.0a5.tar.gz.

File metadata

  • Download URL: elizaos_plugin_gateway-2.0.0a5.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for elizaos_plugin_gateway-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 664d6542df9179b3e249996bc339e5f1a63020abad288be28530a7ba93b90237
MD5 8d05a49909e5abf52bbc70ee11773dd0
BLAKE2b-256 782bd1a13cc9bb1a3bc50d398cf40e0dcc742c004c211d70628ea4718c46d77e

See more details on using hashes here.

File details

Details for the file elizaos_plugin_gateway-2.0.0a5-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_gateway-2.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 377c66429d232f24cc09d59aead187133e9b38d718163aaca09d4c32f13628fc
MD5 70e9810dd13b8c9e59549f19c1f34a3d
BLAKE2b-256 dc669ab86834aa170f8f2c6354eaff66ea6cd8c259c62ce12f12b751329e4519

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