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.0a4.tar.gz (8.1 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.0a4-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for elizaos_plugin_openrouter-2.0.0a4.tar.gz
Algorithm Hash digest
SHA256 d3fc329336bfd2c321dd2a5228f86f34f68ee3c3b6c0078dc4c42e704e504983
MD5 f061e57fa34c6bf7614870f5c79e7198
BLAKE2b-256 3c16adfb3f23c73fde368aeb48b09fa2b54c39a73a28965ddab9ac081e456d0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for elizaos_plugin_openrouter-2.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 4f78fc925d7119d3009367d180c83b171ff26bc538115b3dd2333de10431dc51
MD5 d5f4396cead8eeef2b37cb8d5e106b40
BLAKE2b-256 dc4c1a5b5b5097f3257f7f8ce83d0cd8bb103a47f944f367014ff47c9702684c

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