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_LARGEchat 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elizaos_plugin_vercel_ai_gateway-2.0.0a4.tar.gz.
File metadata
- Download URL: elizaos_plugin_vercel_ai_gateway-2.0.0a4.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9e1f668f9cfc4daa0ed6553c11ae56328a1609351d9b414e98419befe8cb254
|
|
| MD5 |
84a94168e0462de58cc90bd6334b093b
|
|
| BLAKE2b-256 |
66863e47cba3fe179845cadf279bb5f79ca87955e1b90f3f63eee9d29e16bef5
|
File details
Details for the file elizaos_plugin_vercel_ai_gateway-2.0.0a4-py3-none-any.whl.
File metadata
- Download URL: elizaos_plugin_vercel_ai_gateway-2.0.0a4-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7de73f842dda43e07b4dad55db17eef3ed0e2ecf1aaec0016543d657ce238485
|
|
| MD5 |
5c5d5b489fd8236334f96bfe755b4704
|
|
| BLAKE2b-256 |
9d0fcc41fb464a3c7c973c6dee83e6214a27c09559ddc1d1242d50a5335f255f
|