|
1 | 1 | # OpenRouter Plugin |
2 | 2 |
|
3 | | -OpenRouter plugin for vision agents. This plugin provides LLM capabilities using OpenRouter's API, which is compatible with the OpenAI API format. |
| 3 | +This plugin provides LLM capabilities using OpenRouter's API, which offers access to multiple LLM providers through a unified OpenAI-compatible interface. It enables developers to easily switch between different models from various providers (Anthropic, Google, OpenAI, etc.) without changing their code. |
4 | 4 |
|
5 | | -## Note/ Issues |
| 5 | +## Features |
6 | 6 |
|
7 | | -Instruction following doesn't always work with openrouter atm. |
| 7 | +- Access to multiple LLM providers through a single API |
| 8 | +- OpenAI-compatible interface for easy integration |
| 9 | +- Support for various models including Claude, Gemini, GPT, and more |
| 10 | +- Automatic conversion of instructions to system messages |
| 11 | +- Manual conversation history management |
8 | 12 |
|
9 | 13 | ## Installation |
10 | 14 |
|
11 | 15 | ```bash |
12 | | -uv pip install vision-agents-plugins-openrouter |
| 16 | +uv add vision-agents[openrouter] |
13 | 17 | ``` |
14 | 18 |
|
15 | 19 | ## Usage |
16 | 20 |
|
17 | 21 | ```python |
18 | | -from vision_agents.plugins import openrouter, getstream, elevenlabs, cartesia, deepgram, smart_turn |
| 22 | +from vision_agents.core import User, Agent |
| 23 | +from vision_agents.plugins import openrouter, getstream, elevenlabs, deepgram, smart_turn |
19 | 24 |
|
20 | 25 | agent = Agent( |
21 | 26 | edge=getstream.Edge(), |
22 | 27 | agent_user=User(name="OpenRouter AI"), |
23 | 28 | instructions="Be helpful and friendly to the user", |
24 | 29 | llm=openrouter.LLM( |
25 | | - model="anthropic/claude-haiku-4.5", # Can also use other models like anthropic/claude-3-opus |
| 30 | + model="anthropic/claude-haiku-4.5", |
26 | 31 | ), |
27 | 32 | tts=elevenlabs.TTS(), |
28 | 33 | stt=deepgram.STT(), |
29 | | - turn_detection=smart_turn.TurnDetection( |
30 | | - buffer_in_seconds=2.0, confidence_threshold=0.5 |
31 | | - ) |
| 34 | + turn_detection=smart_turn.TurnDetection(), |
32 | 35 | ) |
33 | 36 | ``` |
| 37 | + |
| 38 | +## Configuration |
| 39 | + |
| 40 | +| Parameter | Description | Accepted Values | |
| 41 | +|-----------|-------------|----------------| |
| 42 | +| `api_key` | OpenRouter API key | `str \| None`. If not provided, uses `OPENROUTER_API_KEY` environment variable | |
| 43 | +| `base_url` | OpenRouter API base URL | `str`. Default: `"https://openrouter.ai/api/v1"` | |
| 44 | +| `model` | Model identifier to use | `str`. Default: `"openrouter/andromeda-alpha"`. Examples: `"anthropic/claude-haiku-4.5"`, `"google/gemini-2.5-flash"`, `"openai/gpt-4o"` | |
| 45 | +| `**kwargs` | Additional arguments passed to OpenAI LLM | Any additional parameters supported by the underlying OpenAI LLM implementation | |
| 46 | + |
| 47 | +## Dependencies |
| 48 | + |
| 49 | +- vision-agents |
| 50 | +- vision-agents-plugins-openai |
0 commit comments