Setup
- Create a generic credential or header-auth credential that stores the TokenReply key.
- Add an HTTP Request node with POST and the full /v1/chat/completions endpoint.
- Send a JSON body with an exact catalog model ID and stream set to false for the first test.
- Map choices[0].message.content only after inspecting a successful execution payload.
Method: POST
URL: https://api.tokenreply.com/v1/chat/completions
Authorization: Bearer sk-your-token-here
Content-Type: application/json
{
"model": "YOUR_MODEL_ID",
"messages": [{"role": "user", "content": "{{$json.prompt}}"}],
"stream": false
}
How to verify
- The execution shows HTTP 200 and a JSON response body.
- The API key is stored in credentials, not embedded in exported workflow JSON.
- The response mapping handles an error body before reading choices[0].
Limitations
- The documented n8n OpenAI credential targets OpenAI and may not expose a custom provider URL in every release.
- Streaming responses need a streaming-aware workflow design; start with stream false.
- Imported workflows can expose literal headers, so use n8n credentials or secrets.
Troubleshooting
| Symptom | What it usually means | What to do |
|---|
| The OpenAI node always calls api.openai.com | That node or credential version does not support a custom API host. | Use an HTTP Request node with the full TokenReply endpoint. |
|---|
| The workflow reads choices before an error is checked | The response mapping assumes every request succeeds. | Branch on HTTP status or error first, then extract the successful message. |
|---|