OpenRouter - Unified LLM Interface for ChatGPT, Claude, Gemini
Use the OpenRouter platform to choose the best and most cost effective model for your prompts utilizing a standardized interface (including ChatGPT, Claude, Gemini, Llama, Mistral, and more). See instructions for creating an OpenRouter account and API key.
This Apify Actor integrates with OpenRouter, providing access to a diverse array of Large Language Models (LLMs).
Recommended Use Cases
The OpenRouter Actor can be used in the Apify console or programmatically via the Apify api.
Integration with Other Apify Actors: Use web scraping to collect data and prepare it as training or input data for LLM applications.
Clay Users: From within Clay, generate personalized text for a company or contact, conduct company research, determine the ideal customer persona for a company, and more.
General Integration with LLMs: Suitable for any use case requiring LLM interaction, whether from another Apify actor or an external application.
Single-Turn Requests
This actor supports single-turn messages due to their simplicity and broad applicability for Apify use cases. Multi-message dialog requests are not supported. However, you may send an array of messages to be processed individually which will use the same model parameters for each message.
Inputs
Review the OpenRouter documentation for more detail on specific parameters, supported models, and links to individual model specifications.
Required Inputs:
api_key: Your OpenRouter API key. Encrypted and only used by the Actor at runtime.
messages: An array of messages to process individually.
model: Model specification (e.g., openai/gpt-4o, google/gemini-flash-1.5, cohere/command-r-plus). Defaults to openrouter/auto.
Optional Parameters:
max_tokens: Maximum number of tokens for the model response
response_format: Response format type if not text (note: only option is json_object which is not supported by all models)
stop: Stop sequence for the model
temperature: Sampling temperature
top_p: Nucleus sampling probability threshold
top_k: Top-k sampling value
frequency_penalty: Frequency penalty
presence_penalty: Presence penalty
repetition_penalty: Repetition penalty
seed: Random seed for reproducibility
Example Inputs
Example: Determine the Ideal Customer Persona (ICP) for a Company
Scenario: Given details about a company (e.g., from LinkedIn), determine the Ideal Customer Persona (ICP) for the company.
1{2"api_key":"your-openrouter-api-key",3"messages":[4"Your task is to determine the ideal customer persona (ICP) for a company based on their LinkedIn profile. An ICP is a hypothetical description of the type of customer that would be a perfect fit for the company's products or services. Here is the company's description: Apify is a full-stack web scraping and browser automation platform that lets you extract data from websites and automate workflows on the web. Describe the company's ICP in less than 100 words. Only output the description and no summary text, headings, or other markup."5],6"model":"openrouter/auto"7}
Processing
The actor handles OpenRouter API calls using the provided API key:
Constructs and sends an API call to OpenRouter for each message in the input array.
Processes the response and logs necessary information.
Saves the transformed response to the Apify dataset.
Note: The actor timeout is set to 100 seconds by default. You may need to increase this based on your use case, including the number of messages per actor run and size of response.
Results
After a successful run, the actor returns the following fields:
id: ID assigned by OpenRouter
created: Timestamp of the response
model: Model used for generating the response
content: The generated content
finish_reason: Reason why the response finished
prompt_tokens: Number of tokens in the prompt
completion_tokens: Number of tokens in the completion
total_tokens: Total number of tokens used
Example Output:
1[2{3"id":"gen-hVC5zxaB3vec23r00DNt61hypL7G",4"created":"2024-05-15T14:36:07.000Z",5"model":"mistralai/mistral-large",6"content":"Apify's ideal customer persona is a tech-savvy professional or a business in the data analysis, market research, or e-commerce sectors. They have a strong need for automated web scraping and data extraction to enhance decision-making, monitor competition, or optimize online operations. This persona values efficiency, data quality, and the flexibility to customize scraping processes.",7"finish_reason":"stop",8"prompt_tokens":116,9"completion_tokens":70,10"total_tokens":18611}12]
Actor Input: Configure the actor's input with your OpenRouter API key and the required inputs.
Run the Actor: Run the actor from the Apify console or API.
Using this Actor from Another Apify Actor
If you are developing a custom Actor, you can integrate with LLMs by calling the OpenRouter actor via the Apify api. Actor-to-actor integrations using a DatasetId is not yet supported.
For Clay Users
This actor simplifies the configuration required to utilize the OpenRouter API from within Clay. Typically, integrating with OpenRouter requires using the HTTP API enrichment feature, which may not be available on all Clay plans. This actor provides an easier and cost-effective workaround.
Within a Clay contacts table, add an Apify enrichment column.
In the Apify column settings, select open-router from the actor dropdown.
Specify the JSON input data following the example above, add your OpenRouter api_key in the JSON, and replace variables with column references in your Clay table.
Note: Clay has a cell data limit, so set the max_tokens variable in the input accordingly (~4000 tokens)
Use this Clay template to get started. Enter your Apify api key in Clay settings, and your OpenRouter api key in the body of the Apify enrichment column.
Is it legal to scrape job listings or public data?
Yes, if you're scraping publicly available data for personal or internal use. Always review Websute's Terms of Service before large-scale use or redistribution.
Do I need to code to use this scraper?
No. This is a no-code tool — just enter a job title, location, and run the scraper directly from your dashboard or Apify actor page.
What data does it extract?
It extracts job titles, companies, salaries (if available), descriptions, locations, and post dates. You can export all of it to Excel or JSON.
Can I scrape multiple pages or filter by location?
Yes, you can scrape multiple pages and refine by job title, location, keyword, or more depending on the input settings you use.
How do I get started?
You can use the Try Now button on this page to go to the scraper. You’ll be guided to input a search term and get structured results. No setup needed!