Prerequisites
- An OpenRouter account with an API key (https://openrouter.ai)
Important Notes
- OpenRouter usage may incur costs based on the models you use and your usage volume.
- Be mindful of sensitive data and consider security measures when integrating with external services.
Chat Completions
Create a Table: In Pixeltable, create a table with columns to represent your input data and the columns where you want to store the results from OpenRouter.| input | response |
|---|---|
| How many species of felids have been classified? | There are currently 40 recognized species of felids (members of the family Felidae), which includes all wild cats as well as domestic cats. These range from small cats like the rusty-spotted cat to large cats like tigers and lions. This classification can occasionally be updated as new research provides better understanding of cat taxonomy. |
| Can you make me a coffee? | I cannot make you a coffee as I am an AI language model - I don't have physical form or ability to interact with the physical world. I can, however, give you instructions on how to make different types of coffee, recommend coffee recipes, or provide information about coffee in general. Would you like any of those instead? |
Using Different Models
One of OpenRouter’s key benefits is easy access to models from multiple providers. Let’s create a table that compares responses from Anthropic Claude, OpenAI GPT-4, and Meta Llama.| prompt | claude | gpt4 | llama |
|---|---|---|---|
| Explain quantum entanglement in one sentence. | Quantum entanglement is a phenomenon where two or more particles become so deeply connected that the quantum state of each particle cannot be described independently, even when separated by large distances. | Quantum entanglement is a phenomenon in which two or more particles become interconnected in such a way that the state of one particle instantaneously influences the state of the other, regardless of the distance separating them. | Quantum entanglement is a phenomenon in which two or more particles become interconnected in such a way that their properties, such as spin or polarization, are correlated, regardless of the distance between them. |
Advanced Features: Provider Routing
OpenRouter allows you to specify provider preferences for fallback behavior and cost optimization.| input | response |
|---|---|
| What are the primary colors? | The primary colors are: 1. Red 2. Blue 3. Yellow These are called primary colors because they cannot be created by mixing other colors together, and they can be combined to create all other colors. For example: - Red + Blue = Purple - Blue + Yellow = Green - Red + Yellow = Orange |
Advanced Features: Context Window Optimization
OpenRouter supports transforms like ‘middle-out’ to optimize handling of long contexts.| response |
|---|
| The main AI developments mentioned are: 1. Machine learning algorithms that detect patterns in data. 2. Deep learning, specifically in computer vision and natural language processing. 3. Advancements in reinforcement learning. 4. Developments in generative models. |