跳转到主要内容
n8n is an open-source workflow automation platform. You can use Qhaigc’s OpenAI-compatible API with n8n’s built-in OpenAI node by configuring a custom credential.
The ability to set a custom base URL in n8n’s OpenAI credential depends on your n8n version. Check the n8n OpenAI node documentation for your version to confirm this field is available.

Prerequisites

  • An n8n instance (cloud or self-hosted)
  • A Qhaigc API key — get one from the API Tokens page

Setting Up the Credential

1

Open Credentials settings

In n8n, click Settings in the left sidebar, then select Credentials.
2

Add an OpenAI credential

Click Add Credential, search for OpenAI, and select it.
3

Fill in the Qhaigc configuration

Enter the following values:
FieldValue
NameQhaigc (or any name you prefer)
API KeyYour Qhaigc API key (starts with sk-)
Base URLhttps://api.qhaigc.net/v1
You must set the Base URL. Without it, n8n will send requests to OpenAI’s official API instead of Qhaigc.
4

Save the credential

Click Save to store the configuration.

Using Qhaigc in a Workflow

1

Create a new workflow

Click Add Workflow, then add a trigger node — for example, a Webhook, Schedule, or Manual Trigger.
2

Add an OpenAI node

Add an OpenAI node to your workflow and connect it after the trigger.
3

Configure the OpenAI node

In the node settings:
  1. Set Credential to the Qhaigc credential you created
  2. Set Resource to Chat
  3. Set Operation to Create
  4. Enter a model name in the Model field — for example, gpt-4o, gpt-4o-mini, or claude-3-5-sonnet-20241022
  5. Configure your Messages with the system and user content
n8n’s model list may not include Qhaigc models automatically. Type the model name directly into the Model field rather than selecting from a dropdown.
4

Connect remaining nodes and test

Add any downstream nodes (email, Slack, HTTP request, etc.), then run the workflow to confirm Qhaigc responds correctly.

Example Workflow Patterns

AI content generation on a schedule:
[Schedule Trigger] → [OpenAI: gpt-4o] → [Email]
Smart customer service reply:
[Webhook: incoming message] → [OpenAI: generate reply] → [HTTP Request: send reply]
Daily data summary:
[Schedule: 9 AM] → [HTTP Request: fetch data] → [OpenAI: summarize] → [Slack: post summary]

Frequently Asked Questions

The node shows “Connection failed” — what should I check? Verify that the Base URL in your credential is set to https://api.qhaigc.net/v1 (including /v1), that your API key is valid, and that your n8n instance has outbound internet access. The model dropdown is empty — how do I select a model? Type the model name directly into the Model field. n8n uses a fixed model list for the dropdown, but accepts any string you type manually.

References