OpenRouter avatar

OpenRouter

Pricing

Pay per event + usage

Go to Apify Store
OpenRouter

OpenRouter

You can use any AI LLM model without accounts in AI providers. Use this Actor as a proxy for all requests. Use pay-per-event pricing to pay only for the real credit used.

Pricing

Pay per event + usage

Rating

5.0

(5)

Developer

Apify

Apify

Maintained by Apify

Actor stats

16

Bookmarked

4.1K

Total users

204

Monthly active users

9.5 days

Issues response

15 days ago

Last modified

Categories

Share

OpenRouter Proxy

This Apify Actor creates a proxy for the OpenRouter API, allowing you to access multiple AI models through a unified OpenAI-compatible interface. All requests are charged to your account on the Apify platform on a pay-per-event basis.

What this Actor does

  • Proxy access: Routes your API requests to OpenRouter's extensive collection of AI models
  • OpenAI compatibility: Works seamlessly with the OpenAI SDK and any OpenAI-compatible client
  • Transparent billing: Charges are applied to your Apify account at the same rates as OpenRouter
  • Full feature support: Supports chat completions, embeddings, streaming, and image generation
  • Multiple API formats: Supports OpenAI (/chat/completions), Anthropic (/messages), and OpenAI Responses (/responses) formats
  • No API key management: Uses your Apify token for authentication - no need to manage separate OpenRouter API keys
  • Standby mode: Runs in Standby mode with a static URL, like a standard web server

Supported endpoints

MethodEndpointDescription
POST/api/v1/chat/completionsChat completions (OpenAI format)
POST/api/v1/messagesMessages (Anthropic format)
POST/api/v1/responsesResponses (OpenAI Responses API)
POST/api/v1/embeddingsText embeddings
GET/api/v1/modelsList available models
GET/api/v1/models/countModel count
GET/api/v1/models/userUser model preferences
GET/api/v1/models/{author}/{slug}/endpointsModel endpoints
GET/api/v1/embeddings/modelsEmbedding models
GET/api/v1/providersAvailable providers
GET/api/v1/endpoints/zdrZero-data-retention endpoints
GET/api/v1/generationGeneration details

For full API documentation, see the OpenRouter API docs.

Pricing

This Actor uses a pay-per-event pricing model on the Apify platform. You pay for the tokens used by the OpenRouter API. Free tier users pay 10x more than paying users and are limited to 2,048 tokens per response.

Pricing structure

  • Event: openrouter-api-usage
  • Paying users: Pay the exact OpenRouter cost (rounded up to nearest $0.00001)

Pricing examples

OpenRouter costCalculationCharged eventsYou payMarkup factor
$0.000012120.00001212 / 0.000012$0.000021.65x
$0.00010.0001 / 0.0000110$0.00011x (exact)
$0.0010.001 / 0.00001100$0.0011x (exact)
$0.010.01 / 0.000011,000$0.011x (exact)

Quick start

1. Install the OpenAI package

$npm install openai

2. Basic usage

import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://openrouter.apify.actor/api/v1',
apiKey: 'no-key-required-but-must-not-be-empty', // Any non-empty string works; do NOT use a real API key.
defaultHeaders: {
Authorization: `Bearer ${process.env.APIFY_TOKEN}`, // Apify token is loaded automatically in runtime
},
});
async function main() {
const completion = await openai.chat.completions.create({
model: 'openrouter/auto',
messages: [
{
role: 'user',
content: 'What is the meaning of life?',
},
],
});
console.log(completion.choices[0].message);
}
await main();

3. Streaming responses

const stream = await openai.chat.completions.create({
model: 'openrouter/auto',
messages: [
{
role: 'user',
content: 'Write a short story about a robot.',
},
],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

4. Image generation

OpenRouter supports image generation through compatible models. Use the chat completions API with the modalities parameter:

const response = await openai.chat.completions.create({
model: 'google/gemini-2.5-flash-image', // Vision-capable model
messages: [
{
role: 'user',
content: 'Generate an image of a cute baby sea otter',
},
],
modalities: ['text', 'image'], // Enable image generation
});
// Access generated image from response
console.log(response.choices[0].message);

Note: OpenRouter doesn't support the traditional /images/generations endpoint. Image generation is done through compatible models using the chat completions API. Check available models with image capabilities on OpenRouter's models page.

Available models

This proxy supports all models available through OpenRouter, including models from OpenAI, Anthropic, Google, Meta, Mistral, and many more.

For a complete list, visit OpenRouter's models page or call GET /api/v1/models.

Authentication

The Actor uses your Apify token for authentication. In Actor environments on the Apify platform, APIFY_TOKEN is automatically available. For local development, you can:

  1. Set the environment variable: export APIFY_TOKEN=your_token_here
  2. Or pass it directly in the Authorization header
  3. Find your token in Apify Console

Support

For issues related to this Actor, please open an issue or contact the Actor developer on Apify Store.