> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kymaapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# n8n

> Use Kyma API as an AI provider in n8n automation workflows.

## Setup

Kyma works with n8n's built-in **OpenAI** node since the API is OpenAI-compatible.

<Steps>
  ### Add Credentials

  1. In n8n, go to **Credentials** > **New Credential**
  2. Select **OpenAI API**
  3. Set:
     * **API Key**: Your Kyma API key (`ky-...`)
     * **Base URL**: `https://kymaapi.com/v1`

  ### Add a Chat Node

  1. Add an **OpenAI** node to your workflow
  2. Select the credential you just created
  3. Set **Model** to any Kyma model ID (e.g., `qwen-3.6-plus`)
  4. Configure your prompt

  ### Test

  Run the workflow to verify the connection works.
</Steps>

## Example Workflows

### Email Classifier

1. **Email Trigger** → receives incoming email
2. **OpenAI (Kyma)** → classify as `support`, `sales`, `spam`
3. **Switch** → route based on classification
4. **Slack/Email** → notify the right team

Set the model to `gemini-2.5-flash` or `qwen-3-32b` for fast classification.

### Content Pipeline

1. **Schedule Trigger** → runs daily
2. **HTTP Request** → fetch trending topics from an API
3. **OpenAI (Kyma)** → generate article outline with `qwen-3.6-plus`
4. **OpenAI (Kyma)** → write full article with `deepseek-v3`
5. **WordPress** → publish draft

### Support Auto-Reply

1. **Webhook** → receives support ticket
2. **OpenAI (Kyma)** → draft reply with `qwen-3.6-plus`
3. **If** → check confidence score
4. **Email** → send auto-reply or escalate to human

## Recommended Models

| Use Case          | Model              | Why                               |
| ----------------- | ------------------ | --------------------------------- |
| Classification    | `gemini-2.5-flash` | Cheap active alias + long context |
| Content writing   | `qwen-3.6-plus`    | Best quality                      |
| Data extraction   | `qwen-3-32b`       | Fast + structured                 |
| Complex reasoning | `deepseek-r1`      | Deep reasoning                    |

<Tip>
  Since Kyma is OpenAI-compatible, you don't need a custom n8n node. The built-in OpenAI node works perfectly — just change the base URL.
</Tip>
