Skip to main content

Overview

OpenRouter is a unified API gateway that provides access to 200+ models from providers like Anthropic, Google, Meta, Mistral, and more — all through a single API key and OpenAI-compatible endpoint. By connecting OpenRouter as a custom model provider in Zencoder, you can:
  • Access models not natively available in the Zencoder model selector
  • Use a single API key for multiple providers
  • Take advantage of OpenRouter’s automatic fallback and routing
  • Use open-source models (Llama, Mistral, Qwen, DeepSeek) alongside commercial ones

Prerequisites

Step-by-Step Setup

1

Get your OpenRouter API key

Go to openrouter.ai/keys and create a new API key. Copy it — you’ll need it in the next step.
2

Open your Zencoder settings file

Open the settings file at one of these locations:
  • Machine-wide: ~/.zencoder/settings.json
  • Per project: .zencoder/settings.json (in your repo root)
Create the file if it doesn’t exist.
3

Add the OpenRouter provider

Paste the following configuration, replacing your-openrouter-api-key with your actual key:
4

Reload settings

Restart the Zencoder extension or Zenflow app to pick up the new provider. Your OpenRouter models will appear in the model selector.

Adding More Models

To add any model from the OpenRouter model list, add a new entry under the "models" object. The "name" field must match OpenRouter’s model identifier (e.g., anthropic/claude-sonnet-4, google/gemini-2.5-pro).
Use descriptive displayName values that include “(OpenRouter)” so you can distinguish these from Zencoder’s built-in models in the selector.

Keeping Zencoder Default Models

By default, OpenRouter models appear alongside Zencoder’s built-in models. If you want to hide the built-in catalog and only show your OpenRouter models, add "useDefaultProviders": false at the top level:

Securing Your API Key

Instead of storing your API key directly in the JSON file, you can use an environment variable:
  1. Remove the "apiKey" field from the provider config
  2. Export the key in your shell profile:
Zencoder will automatically look for ZENCODER_<PROVIDER>_API_KEY if no inline key is found.

Troubleshooting

Restart Zencoder or Zenflow after editing settings.json. Verify the JSON is valid — a missing comma or bracket will silently fail.
Check that your OpenRouter API key is valid and has sufficient credits. Verify the model name matches the exact identifier on openrouter.ai/models.
Some OpenRouter models queue during peak hours. Try a different model or check openrouter.ai/activity for current status.

Custom Models (BYOM)

Full reference for configuring custom model providers

Model Selection & BYOK

Built-in models and Bring Your Own Key setup