elizaOS OpenRouter Plugin - Multi-model AI gateway client for text and object generation
Project description
elizaOS Plugin OpenRouter (Python)
OpenRouter plugin for elizaOS - Multi-model AI gateway client for text and object generation.
Installation
pip install elizaos-plugin-openrouter
Usage
from elizaos_plugin_openrouter import OpenRouterClient, OpenRouterConfig
# Create a client with API key
config = OpenRouterConfig.from_env()
client = OpenRouterClient(config)
# Generate text
response = await client.generate_text_large("What is the meaning of life?")
print(response.text)
# Generate embeddings
embedding = await client.generate_embedding("Hello, world!")
print(f"Embedding dimension: {len(embedding.embedding)}")
Configuration
The client can be configured via environment variables:
| Variable | Description | Default |
|---|---|---|
OPENROUTER_API_KEY |
API key for authentication (required) | - |
OPENROUTER_BASE_URL |
Base URL for the API | https://openrouter.ai/api/v1 |
OPENROUTER_SMALL_MODEL |
Model for small text generation | google/gemini-2.0-flash-001 |
OPENROUTER_LARGE_MODEL |
Model for large text generation | google/gemini-2.5-flash |
OPENROUTER_EMBEDDING_MODEL |
Model for embeddings | openai/text-embedding-3-small |
OPENROUTER_EMBEDDING_DIMENSIONS |
Embedding dimensions | 1536 |
OPENROUTER_TIMEOUT_SECONDS |
Request timeout | 60 |
Features
- Text Generation: Generate text using various models (Claude, GPT, Gemini, etc.)
- Object Generation: Generate structured JSON objects
- Text Embeddings: Generate embeddings for semantic search
- Multi-Model Support: Access 100+ models through a single API
Requirements
- Python 3.11+
- OpenRouter API key (https://openrouter.ai)
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_openrouter-2.0.0a4.tar.gz.
File metadata
- Download URL: elizaos_plugin_openrouter-2.0.0a4.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3fc329336bfd2c321dd2a5228f86f34f68ee3c3b6c0078dc4c42e704e504983
|
|
| MD5 |
f061e57fa34c6bf7614870f5c79e7198
|
|
| BLAKE2b-256 |
3c16adfb3f23c73fde368aeb48b09fa2b54c39a73a28965ddab9ac081e456d0b
|
File details
Details for the file elizaos_plugin_openrouter-2.0.0a4-py3-none-any.whl.
File metadata
- Download URL: elizaos_plugin_openrouter-2.0.0a4-py3-none-any.whl
- Upload date:
- Size: 9.7 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 |
4f78fc925d7119d3009367d180c83b171ff26bc538115b3dd2333de10431dc51
|
|
| MD5 |
d5f4396cead8eeef2b37cb8d5e106b40
|
|
| BLAKE2b-256 |
dc4c1a5b5b5097f3257f7f8ce83d0cd8bb103a47f944f367014ff47c9702684c
|