Skip to main content

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

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_openrouter-2.0.0a5.tar.gz (8.0 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_openrouter-2.0.0a5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for elizaos_plugin_openrouter-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 5462b58a0763737462ab4c14f05c49bd375076ba04dd29ae9b9a292cf3e001d2
MD5 734dbf079a368b315086ecb6a65b610f
BLAKE2b-256 578a66463e5c35bbe7699501f8b228578987ba410fcf533a0c0b35b8f00af4bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for elizaos_plugin_openrouter-2.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 253f7da504a3be970004babcb068532bc5d61830f4b6afcb86e23e66e931c30a
MD5 13def8fbb88698e58b786e301d514dd1
BLAKE2b-256 a1965902a8723851ad37316e19720d70d2a260ab83e77c36c21873676d7f01b5

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