Skip to main content
OpenRouter provides access to hundreds of models from many labs through a single unified API. PromptLayer supports OpenRouter as a first-class, native provider using the official OpenRouter SDK — so you configure one API key and get chat, image generation, video generation, and text-to-speech, with full request logging, streaming, and cost tracking.
OpenRouter is now a native provider — you no longer need to set it up as an OpenAI-compatible custom provider. The legacy custom provider approach still works, but the native integration is recommended because it uses the official OpenRouter SDK and unlocks image, video, and speech capabilities.

Configuring your OpenRouter API key

  1. Get an OpenRouter API key: Sign up at OpenRouter and create a key in their dashboard.
  2. In your PromptLayer workspace settings, open the provider API keys section and add your OpenRouter key (the same place you add OpenAI, Anthropic, or Google keys).
Your key is stored encrypted per workspace and is used to run OpenRouter requests from the Playground, Prompt Registry, evaluations, and workflows.
When you run through the SDK with promptlayer.run(), the OpenRouter call is executed locally with the OPENROUTER_API_KEY on your machine — your provider key is never sent to PromptLayer.

Capabilities

OpenRouter models in PromptLayer are grouped by API type. When you select OpenRouter in the Playground, an API selector lets you switch between the capabilities below, and the model dropdown lists only the models that support the selected one. Additional chat features are supported per model, gated by OpenRouter’s model metadata:
  • Streaming — token-by-token streaming for chat.
  • Structured outputs — JSON Schema response_format on models that advertise support.
  • Function / tool calling — your Prompt Registry tools map to OpenRouter tools.
  • Server (built-in) tools — OpenRouter server tools such as web search are available in the Functions editor as built-in tools for OpenRouter models. See Tool Calling.
The full, up-to-date catalog is on OpenRouter’s models page.

Using OpenRouter in the Playground

  1. Open the Playground.
  2. Select OpenRouter from the provider dropdown.
  3. Choose the API type (Chat, Images, Video, or Speech).
  4. Pick a model from the dropdown.
  5. For Speech, choose a voice and response format in the model controls.
  6. Run your prompt. Chat streams live; image, video, and speech return the generated media inline (audio plays with a built-in player).
Generated media, token counts, and cost appear in the request log the same way as other providers.

Speech (text-to-speech)

Speech models take the prompt text as the input to synthesize and require a voice parameter. The voice dropdown for each model is populated from that model’s own OpenRouter-advertised voice list, sorted alphabetically. The response is returned as playable audio and logged as an audio output.

SDK usage

Once you’ve configured your OpenRouter key and created a prompt template that uses an OpenRouter model, run it with the PromptLayer SDK. The API type (chat / images / video / speech) is derived from the template’s model configuration, so the same run() call works for every capability.
Using promptlayer.run() ensures your requests are logged to PromptLayer and uses your Prompt Registry templates. This is the recommended approach for production.