n8n
n8n can call OdiRouter directly with the HTTP Request node. This method works even when your n8n version’s built-in OpenAI node does not expose a custom Base URL.
Requirements
Section titled “Requirements”| Requirement | Value |
|---|---|
| n8n | Cloud or self-hosted workflow |
| Node | HTTP Request |
| Method | POST |
| URL | https://www.odirouter.ai/v1/chat/completions |
| API Key | OdiRouter API key |
Create A Credential
Section titled “Create A Credential”- Open n8n credentials.
- Create a header-based credential if your n8n version supports reusable headers.
- Add this header:
Authorization: Bearer YOUR_API_KEYIf you do not use a credential, add the header directly in the HTTP Request node.
Configure The HTTP Request Node
Section titled “Configure The HTTP Request Node”| Field | Value |
|---|---|
| Method | POST |
| URL | https://www.odirouter.ai/v1/chat/completions |
| Send Headers | Enabled |
Header Authorization | Bearer YOUR_API_KEY |
Header Content-Type | application/json |
| Send Body | JSON |
Request Body
Section titled “Request Body”{ "model": "gpt-5.5", "messages": [ { "role": "user", "content": "Summarize the previous workflow item in one sentence." } ]}Read The Result
Section titled “Read The Result”The HTTP Request node returns the full JSON response. Read the assistant text from:
choices[0].message.contentIn downstream n8n nodes, use this expression:
{{$json["choices"][0]["message"]["content"]}}If downstream nodes only need text, add a Set/Edit Fields node after the HTTP Request node and create:
| Field | Value |
|---|---|
model_output | {{$json["choices"][0]["message"]["content"]}} |
Then Email, Slack, Webhook Response, database, or IF nodes can read model_output directly.
Multimodal Queue Workflow
Section titled “Multimodal Queue Workflow”For asynchronous multimodal models:
- Call
POST https://www.odirouter.ai/model/v1/queue/{endpoint}. - Save
status_urlandresponse_urlfrom the response. - Poll
status_urluntil the status isCOMPLETED. - Fetch
response_url.
Recommended node flow:
| Step | n8n node | Key fields |
|---|---|---|
| Create task | HTTP Request | request_id, status_url, response_url |
| Save URLs | Set/Edit Fields | status_url, response_url |
| Wait | Wait | Choose an interval based on model runtime |
| Check status | HTTP Request | Use {{$json["status_url"]}} as the URL |
| Branch | IF | Check whether status equals COMPLETED |
| Fetch result | HTTP Request | Use {{$json["response_url"]}} as the URL |
If the status is not COMPLETED, route the IF node back to Wait and poll again. The final result usually contains file URLs or text fields; use Set/Edit Fields to normalize the fields your workflow needs, such as result_url, result_text, or a business-specific name.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Fix |
|---|---|
| 401 response | Check the Authorization header |
| 400 JSON error | Ensure the HTTP Request node sends JSON, not form data |
| Model not found | Use a model from GET https://www.odirouter.ai/v1/models |
| Workflow times out | Use the multimodal queue pattern for long-running image, video, audio, or 3D tasks |