Lab instances are ephemeral: the owner account (email, first name, last name, password) you create is temporary and tied to that lab session only. Feel free to reuse different credentials for different lab runs.



Start the workflow
- Click Start from Scratch.
- Build a simple Email AI Agent:
- Trigger: Chat Trigger
- Chain: Chat input → AI model node → Gmail node

AI Model Options: KK Keyspace vs. Official OpenAI API
In the KodeKloud lab you can use either KodeKloud Keyspace (KK Keyspace) or an official OpenAI API key. Each option has slightly different steps.
Using KK Keyspace (lab-provided)
- Follow the lab instructions (left-hand panel) to open the KK Keyspace dashboard and copy:
- Keyspace base URL
- Keyspace API key
- In n8n, create a new credential for the OpenAI/Chat node:
- Paste the Keyspace API key
- Leave organization ID blank
- Set the base URL to the Keyspace base URL
- Save and test the credential.



Using an official OpenAI API key
- Go to https://platform.openai.com and create an API key:
- Sign in → View API keys → Create new secret key (label it like
n8n email integration) - Copy the secret
- Sign in → View API keys → Create new secret key (label it like
- In n8n, create an OpenAI credential:
- Paste the API key
- Leave base URL as default
- The model dropdown will populate with standard OpenAI names — you can select GPT-4.1 (or other supported models) directly.


Quick comparison: KK Keyspace vs OpenAI API
| Area | KK Keyspace (lab) | Official OpenAI API |
|---|---|---|
| Credential base URL | Must set Keyspace base URL | Uses default api.openai.com |
| Model selection | May require exact model ID (OpenAI/GPT-4.1) | Models appear in dropdown |
| Credential source | KK Keyspace dashboard | platform.openai.com |
| Typical failure mode | Model not found when chosen from dropdown | API key misconfigured or rate-limited |
Gmail and Google OAuth in the lab
In n8n Cloud you sometimes get a “Sign in with Google” button that uses your browser session. In the KodeKloud lab you must create OAuth credentials in Google Cloud Console and paste them into the Gmail credential in n8n.
- Open
https://console.cloud.google.comand create a new project (e.g.,n8n email app). Select No organization and Create. - Select the new project and enable the Gmail API.

- Configure the OAuth consent screen:
- Set App name (e.g.,
n8n email) - Provide a support/contact email
- Choose External and fill required fields
- Set App name (e.g.,
- Add a test user (the email you’ll use for testing), for example
marconi@kodekloud.com, and save.

- Go to API & Services → Credentials → Create Credentials → OAuth client ID:
- Application type: Web application
- Name: e.g.,
n8n email OAuth client - Add the authorized redirect URI from your lab’s credential setup page
- Create the client and copy the Client ID and Client Secret

- Paste the Client ID and Client Secret into the Gmail credential in the n8n lab. After doing so a “Sign in with Google” button will appear — use it to authenticate with the test user and grant the requested scopes.

When you see the “unverified app” message, it is expected for test apps created in your own Google Cloud project. Only proceed if you created the project and trust the app; otherwise, do not grant access.
Test the complete workflow
With the Chat Trigger, AI model, and Gmail credential in place, test the end-to-end flow:- Trigger using the Chat Trigger: “Hi, can you send an email to coding@dot.com to just say hello?”
- Execute the workflow and check the target inbox. You should receive a simple generated email (for example: “Hello Marconi, I just want to say hello. Best regards.”).
Troubleshooting tips
- If AI model calls fail with KK Keyspace: verify the base URL, API key, and paste the exact model ID string from lab instructions.
- If the OpenAI model list is empty: ensure your OpenAI API key is correct and saved in the OpenAI credential.
- If Google OAuth fails: confirm the redirect URI in Google Cloud Console exactly matches the URI shown in the n8n credential setup page, and that test user is added to the OAuth consent settings.
- Remember that some issues are environment-specific (lab vs Cloud vs self-host). When a node behaves differently in a lab, re-check credential configuration and environment-specific instructions.
Links and references
- n8n documentation: https://docs.n8n.io/
- OpenAI platform: https://platform.openai.com
- Google Cloud Console: https://console.cloud.google.com
- KodeKloud Labs: https://kodekloud.com