š n8n Integration: CodingPlanX Custom LLM Tutorial
In n8n, you can easily connect to third-party Large Language Models (LLMs) by configuring a Custom API Domain and API Key.
This tutorial demonstrates how to configure and use custom AI models in n8n using https://api.codingplanx.ai as an example.
š Prerequisites
Before you begin, ensure you have:
- A running instance of n8n (Self-hosted or Cloud version).
- A CodingPlanX API Key (usually starting with
sk-orcr_). - The specific Model Name you wish to call (e.g.,
gpt-4o,claude-3-5-sonnet, etc.).
š ļø Step 1: Create API Credentials in n8n
Since most custom APIs are OpenAI-compatible, we will use the built-in OpenAI credential type.
- Open your n8n dashboard and click Credentials in the left sidebar.
- Click the + Add Credential button in the top right.
- Search for
OpenAIand select OpenAI API.
āļø Step 2: Configure Custom API URL and Key
In the credential configuration window, fill in the following:
-
Name: Give this credential a recognizable name, e.g.,
CodingPlanX API. -
API Key: Enter your API Key (
sk-xxxxxx...). -
Base URL (Crucial Step):
- By default, n8n uses the official OpenAI URL. We need to override this.
- Find the Base URL field (if not visible, ensure your n8n version supports custom Base URLs or check under advanced settings).
- Change the address to:
https://api.codingplanx.ai/v1
> š” Note: Most OpenAI-compatible APIs require the
/v1suffix. Do not omit it. -
Click Save. If configured correctly, you should see a
Connection tested successfullymessage.
š§© Step 3: Add and Configure the AI Node in a Workflow
Now, let's use the credential in a workflow.
- Go to Workflows and click + Add workflow.
- Click the + icon on the canvas, search for and add an OpenAI node (usually AI Chat Model).
- Open the node settings:
- Credential to connect with: Select the
CodingPlanX APIyou just created. - Model:
- Since this is a custom API, the dropdown might not list your specific model.
- Click the āļø (gear icon) next to the Model field or select
Expression/Custommode. - Manually enter the model name, e.g.,
gpt-3.5-turboor your specific Claude ID.
- Credential to connect with: Select the
ā Step 4: Test the Connection
- Connect a Manual Trigger node to your AI node.
- Enter a test prompt in the AI node, e.g.,
"Hello, please introduce yourself.". - Click Execute Node or Test step.
- Check the Output panel on the right. If you see an AI response, congratulations! Your custom model is successfully integrated! š
ā Troubleshooting (FAQ)
Q1: Error Invalid API Key or AuthenticationError?
- Check if the API Key is copied correctly without extra spaces.
- Ensure your CodingPlanX account has sufficient balance.
Q2: Error Resource not found or 404?
- Re-check the Base URL in Step 2. Ensure it includes
https://api.codingplanx.ai/v1(check for missing/v1or extra trailing slashes).
Q3: Error Model not found?
- Verify that the Model Name you typed manually is correct. Refer to the CodingPlanX model list for exact IDs.