DeveloperHow to get an OpenRouter API key

How to get an OpenRouter API key

Copy page

Create an OpenRouter API key and connect it to Workflow Functions to write functions with Claude, GPT, Gemini and more.

OpenRouter gives you one key for models from many companies - Claude, GPT, Gemini, Llama, Mistral, DeepSeek and more. To use it with Write with AI, connect your own OpenRouter key.

Create the key

  1. Go to OpenRouter and sign in (or create an account): openrouter.ai.
  2. Add credits under Credits - generation is billed to your OpenRouter account.
  3. Open Keys - direct link: openrouter.ai/settings/keys - select Create key, name it (for example Workflow Functions) and copy the key. It starts with sk-or-.

Connect it

  1. In your Shopify admin, open Workflow Functions -> Developer -> Connections.
  2. Paste the key into the OpenRouter card and select Save key. The key is checked with OpenRouter before it is saved.
  3. Pick a default model from the list, or enter any OpenRouter model id, for example anthropic/claude-sonnet-5.

Your key is encrypted and used only for generation - it is never shown again and never runs inside your functions. Then open a function and select Write with AI.

The Connections tab with cards for Anthropic, OpenAI, Google Gemini and OpenRouter
Developer, Connections: one card per AI provider.

Generation is billed to your own OpenRouter account, not your Workflow Functions plan. See Generate functions with AI.