# n8n (/docs/guides/n8n)

Use cheapaimodel models in n8n AI Agent and LLM chain workflows through the OpenAI credential.



n8n's **OpenAI** credential has a **Base URL** field. Point it at cheapaimodel, then use the credential in the **OpenAI Chat Model** sub-node of an **AI Agent** or **Basic LLM Chain**.

|          | n8n setting                      | Value                                                                             |
| -------- | -------------------------------- | --------------------------------------------------------------------------------- |
| Base URL | **Base URL** (OpenAI credential) | `https://api.cheapaimodel.ai/v1`                                                  |
| API key  | **API Key** (OpenAI credential)  | Your key from the console's [API Keys](https://console.cheapaimodel.ai/keys) page |
| Model ID | **Model** (OpenAI Chat Model)    | `deepseek-v4-1-flash`, or any ID from the [catalog](/models)                      |

## Set it up [#set-it-up]

<Steps>
  <Step>
    ### Create the credential [#create-the-credential]

    Create a new **OpenAI** credential and fill in:

    * **API Key**: your cheapaimodel key.
    * **Organization ID (optional)**: leave empty.
    * **Base URL**: `https://api.cheapaimodel.ai/v1`.

    Save it. n8n tests the credential by requesting `/v1/models` with the key.
  </Step>

  <Step>
    ### Add the chat model [#add-the-chat-model]

    On an **AI Agent** or **Basic LLM Chain** node, attach **OpenAI Chat Model** to the **Chat Model** input and select the credential. Under **Model**, use **From List** to pick from the models your key can use, or **ID** to type `deepseek-v4-1-flash`.

    **Use Responses API** is on by default and sends requests to `/v1/responses`; turned off, the node uses `/v1/chat/completions`. The catalog's models list both. Leave **Built-in Tools** empty: Web Search, File Search and Code Interpreter run on OpenAI's platform, not on cheapaimodel.
  </Step>
</Steps>

An AI Agent's tool use depends on the model's tool calling. If a model handles tools poorly, try another model from the catalog.

## The OpenAI node [#the-openai-node]

<Callout type="warn">
  The standalone **OpenAI** node uses the same credential, but most of its operations call endpoints cheapaimodel doesn't serve: images, audio, files, video, conversations and **Classify Text for Violations**. Use it only for **Text → Message a Model**, or use the OpenAI Chat Model sub-node above.
</Callout>

cheapaimodel has no embeddings models yet. For vector stores, connect an embeddings node backed by another provider, not this credential.

## Common mistakes [#common-mistakes]

* **The credential test fails with `404` and `fault filter abort`.** **Base URL** is missing `/v1`. Set `https://api.cheapaimodel.ai/v1`.
* **The workflow fails with `404` and `Invalid URL (POST /v1/chat/completions/responses)`.** **Base URL** includes the endpoint path; with **Use Responses API** off the doubled path ends in `/chat/completions/chat/completions` instead. n8n adds the path itself; set `https://api.cheapaimodel.ai/v1`.
* **`401`.** The key is wrong, expired or out of budget. Check it in the console.
* **`503` with `model_not_found`.** The ID typed in **ID** mode doesn't match the [catalog](/models). Switch to **From List** or fix the spelling.
