OpenRouter gives your WhatsApp chatbot access to every major AI model through one endpoint and one API key. Swap models by changing one word in the request body, with no re-configuration and no new keys.
The other guides in this series each cover a single provider with its own key and its own auth pattern. OpenRouter flips that: one key, one endpoint, one billing account, and you choose the model inside the request body. That makes it the most flexible starting point if you are not sure which AI provider suits your use case, or if you want to run the same WhatsApp flow with different models to compare results.
OpenRouter is also the easiest path to models that do not have their own direct API set up in the External API Request step, like Meta's Llama models, Mistral's less-common variants, or Perplexity's Sonar. As long as OpenRouter carries the model, you can reach it from WA.Expert.
New to the External API Request step? Read the foundation guide first.
For a WhatsApp chatbot that needs quick replies, start with a fast and inexpensive model like openai/gpt-4o-mini or mistralai/mistral-small. Once you are happy with the flow, you can upgrade to a larger model by changing one word in the body.
The endpoint is the same regardless of which model you use. Only the model field in the body changes.
https://openrouter.ai/api/v1/chat/completions| Header | Value |
|---|---|
| Authorization | Bearer YOUR_SK_OR_KEY |
| Content-Type | application/json |
Same Bearer auth pattern as OpenAI and Mistral.
The model field uses the provider/model-name format. Swap this one value to change providers.
{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are a helpful support assistant. Answer briefly."
},
{
"role": "user",
"content": "{{customer_message}}"
}
]
}
/* To switch to Claude, change the model line to: */
/* "model": "anthropic/claude-sonnet-4-6" */
/* To switch to Gemini: */
/* "model": "google/gemini-3.5-flash" */| To use | model value in body |
|---|---|
| OpenAI GPT-4o mini | openai/gpt-4o-mini |
| OpenAI GPT-4o | openai/gpt-4o |
| Anthropic Claude Sonnet | anthropic/claude-sonnet-4-6 |
| Google Gemini Flash | google/gemini-3.5-flash |
| Mistral Small | mistralai/mistral-small-latest |
| Perplexity Sonar | perplexity/sonar |
| Meta Llama 3 | meta-llama/llama-3.3-70b-instruct |
Model IDs change as providers release new versions. Check openrouter.ai/models for the current ID before building.
OpenRouter always returns the same structure regardless of the underlying model. The response path is identical to OpenAI.
{
"choices": [
{
"message": {
"role": "assistant",
"content": "...the model's reply is here..."
}
}
]
}Map choices[0].message.content into your WhatsApp message. This path works regardless of whether the underlying model is GPT, Claude, or Gemini. OpenRouter normalises the response format.
If you build your WA.Expert flow to read from choices[0].message.content, you can switch the AI provider by changing only the model name in the request body. Your flow's mapping step never needs to change. That is the practical value of OpenRouter's standardisation.
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 Unauthorized | Wrong key or missing Bearer prefix | Check the key starts with sk-or- and the header value begins with Bearer |
| 402 Payment Required | No credits | Add credits at openrouter.ai |
| 404 or model not found | Model ID wrong or model no longer offered | Check openrouter.ai/models for the correct current ID |
| Slow response | Some models have higher latency through OpenRouter | Try a faster model or go direct to that provider for production |
| Different response structure | Rare with some models | Verify against OpenRouter's docs for the specific model; most follow the standard format |
Free trial, no credit card required. And if you ever get stuck, we are the only platform in India that answers you live on WhatsApp.