OpenRouter Setup Guide

Setting up your OpenRouter API connection gives you access to 450+ AI models from providers like Anthropic (Claude), Google (Gemini), Meta (Llama), and many more. This guide will walk you through getting your API key from OpenRouter and connecting it to your WordPress site.

What You'll Need

Before you begin, make sure you have:

  • An OpenRouter account (you can create one at openrouter.ai)
  • Administrator access to your WordPress site
  • FreshRank AI Pro (OpenRouter is a Pro-only feature)
  • Credits added to your OpenRouter account (required for API access)

Step 1: Get Your OpenRouter API Key

First, you'll need to create an API key in your OpenRouter account.

  1. Log in to OpenRouter
    • Go to openrouter.ai
    • Sign in with your OpenRouter account credentials
  2. Navigate to API Keys
  3. Create a New API Key
    • Click the "Create API Key" button

Create API key on OpenRouter

    • Give your key a recognizable name (e.g., "FreshRank")
    • Click "Create"

  1. Copy Your API Key
    • OpenRouter will display your new API key
    • Click the copy button to copy the key to your clipboard
    • Important: Store this key somewhere safe for future reference

Copy and save OpenRouter API key

⚠️ Warning: Never share your API key publicly or commit it to version control. Anyone with your key can make API calls that will be charged to your account.


Step 2: Add Your API Key to FreshRank

Now that you have your API key, let's connect it to FreshRank AI.

  1. Open FreshRank Settings
    • In your WordPress admin panel, go to FreshRank AI → Settings
    • You'll land on the Settings tab by default
  2. Locate the AI Configuration Card
    • On the Settings page, find the AI Configuration card (it's the first card on the left)
  3. Select OpenRouter as Your Provider
    • Click on the Provider dropdown at the top of the card
    • Select OpenRouter
    • The card will update to show OpenRouter-specific settings
  4. Enter Your API Key
    • Paste your OpenRouter API key into the API Key field
    • Don't worry - your key will be encrypted and stored securely in your database

Enter OpenRouter API key

  1. Select Your AI Models
    • Use the Analysis Model dropdown to choose which model to use for content analysis
    • Use the Content Rewrite Model dropdown to choose which model to use for draft generation
    • You can select different models for each task or use the same model for both
    • Models are displayed with popularity rankings to help you choose

Select OpenRouter model for analysis

💡 Tip: If you don't see the model list populated, refresh the Settings page after entering your API key. The plugin needs to fetch the available models from OpenRouter.

  1. Save Your Settings
    • Click the "Save Changes" button at the bottom of the page
    • You'll see a confirmation message when your settings are saved
  2. Test Your Connection
    • Click the "Test Connection" button
    • If successful, you'll see a green confirmation message
    • If there's an error, see the Troubleshooting section below

Test OpenRouter connection


Using Custom Model IDs

If you want to use a newly released model that hasn't appeared in the dropdown yet:

  1. Find the Model ID
    • Visit openrouter.ai/models
    • Find your desired model
    • Copy the model ID (e.g., "anthropic/claude-3-sonnet")
  2. Enter Custom IDs in FreshRank
    • In the AI Configuration card, look for Custom Model ID fields
    • Enter the analysis model ID in the first field
    • Enter the writing model ID in the second field
    • These will override the dropdown selections

What Happens Next?

Once your OpenRouter API is connected:

  1. Analysis Ready: You can now analyze your blog posts using your chosen OpenRouter models
  2. Draft Generation: FreshRank will use your selected writing model to generate content updates
  3. Model Flexibility: You can switch models at any time without losing data

Your API key will be used every time you:

  • Run an analysis on a blog post (uses Analysis Model)
  • Generate a draft update for a post (uses Content Rewrite Model)
  • Use the bulk analysis features

Troubleshooting Common Issues

"OpenRouter API key is not configured"

Problem: You're trying to use FreshRank but haven't entered an API key yet.

Solution: Follow Step 2 above to add your API key in the Settings page.


"OpenRouter API error (HTTP 401): Invalid API key"

Problem: The API key you entered is incorrect or has been revoked.

Solutions:

  1. Double-check that you copied the entire key (no extra spaces or missing characters)
  2. Go back to OpenRouter and verify the key still exists
  3. If the key was deleted, create a new one and update FreshRank settings
  4. Make sure you're copying from the correct OpenRouter account (if you have multiple)

Model List Not Loading

Problem: The Analysis Model and Writing Model dropdowns are empty or not showing options.

Solutions:

  1. Make sure you've entered a valid API key first and saved the settings
  2. Refresh the Settings page after entering your API key
  3. Check that your server can connect to openrouter.ai
  4. Wait a few seconds - the plugin fetches models in the background
  5. If models still don't appear, try the Test Connection button to verify your API key works

"OpenRouter API error (HTTP 429): Rate limit exceeded"

Problem: You've made too many API requests in a short time period, or you've run out of credits.

Solutions:

  1. Check your OpenRouter balance at openrouter.ai/credits
  2. Add more credits to your account if needed
  3. Wait 5-10 minutes and try again
  4. Avoid running bulk operations on many posts at once
  5. If this happens frequently, spread out your analysis tasks throughout the day

💡 Tip: You can check your OpenRouter usage and credit balance at openrouter.ai/activity


Test Connection Button Shows an Error

Problem: The test connection fails even though you've entered a valid key.

Possible causes and solutions:

  1. Network/Firewall Issue
    • Your hosting provider may be blocking connections to OpenRouter
    • Contact your host and ask them to allow connections to openrouter.ai
  2. Insufficient Credits
    • Make sure you have credits added to your OpenRouter account
    • Check your balance at openrouter.ai/credits
  3. PHP cURL Not Enabled
    • FreshRank needs the PHP cURL extension to connect to OpenRouter
    • Contact your hosting provider to enable cURL if it's disabled
  4. Connection test failed
    • If you just created a new OpenRouter account, the 'Test Connection' button might show a 'Connection test failed' error. Try running any AI-powered action in FreshRank (like running an analysis on a single article). If you don't get an error and analysis completes, then you're all set and your API key is working. After some time the 'Test Connection' button will show a success message.

Higher Latency Than Expected

Problem: OpenRouter requests seem slower than direct OpenAI connections.

Explanation: OpenRouter routes requests through their infrastructure, which may add slight latency compared to direct provider connections. This is normal and the trade-off for accessing 450+ models through a single API.

Solutions:

  1. Choose faster models (like Claude Haiku or GPT-3.5 Turbo)
  2. Be patient - the flexibility is worth the small delay
  3. For time-critical tasks, consider using OpenAI directly

Security Best Practices

To keep your API key secure:

Do:

  • Store your API key only in the FreshRank settings (it's encrypted in your database)
  • Use a unique API key for each WordPress site
  • Regularly monitor your OpenRouter usage for unexpected activity
  • Revoke and regenerate your key if you suspect it's been compromised
  • Set up spending limits in your OpenRouter account

Don't:

  • Share your API key in support forums or emails
  • Store your API key in plain text files or spreadsheets
  • Use the same key across multiple sites or applications
  • Commit your API key to GitHub or other version control systems

Monitoring Your API Usage

To keep track of your OpenRouter costs:

    • Visit openrouter.ai/activity
    • View detailed breakdowns by model and date
    • See your current credit balance
    • Set up spending limits to prevent unexpected charges

Next Steps

Now that your OpenRouter API is connected, you're ready to:

  1. Configure Content Update Filters to control what gets updated
  2. Connect Google Search Console (optional but recommended for better prioritization)
  3. Analyze your first post and see what FreshRank finds with your chosen models
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us