Skip to main content

Overview

n8n can use any OpenAI-compatible API. With NanoGPT, you get:
  • One API key for 50+ models (GPT-5.2, Claude Opus 4.5, Gemini 3 Flash Preview, and more)
  • The ability to switch models without changing your workflow logic
  • Unified billing across providers

Prerequisites

  • An n8n instance (desktop app, self-hosted, or n8n Cloud)
  • A NanoGPT account and API key from nano-gpt.com/api

Step 1: Get your NanoGPT API key

  1. Go to nano-gpt.com/api
  2. Click “Create New API Key”
  3. Copy the key (format: sk-nano-...)
  4. Store it securely, you will not be able to view it again

Step 2: Create OpenAI credentials in n8n

  1. Open your n8n instance
  2. Go to Credentials in the left sidebar
  3. Click + Add Credential
  4. Search for and select OpenAI
  5. Fill in the fields:
FieldValue
Credential NameNanoGPT (or any name you prefer)
API Keysk-nano-YOUR-API-KEY
Base URLhttps://nano-gpt.com/api/v1
  1. Click Save

Step 3: Use NanoGPT in a workflow

  1. Go to Workflows and click + New Workflow
  2. Add an OpenAI node or Chat OpenAI node
  3. In the node settings:
    • Credential: Select your NanoGPT credential
    • Model: Enter the model name exactly (examples below)
    • Configure your prompt or messages
  4. Click Execute Node to test

Available models

Use any model listed on the NanoGPT pricing page. Enter the model name exactly as shown.
ModelProviderBest for
openai/gpt-5.2OpenAIBest overall
anthropic/claude-opus-4.5AnthropicDeep reasoning, writing
anthropic/claude-sonnet-4.5AnthropicCoding, analysis
google/gemini-3-flash-previewGoogleFast, cost-effective
google/gemini-3-pro-previewGoogleLong context, reasoning
zai-org/glm-4.7ZhipuOpen model alternative

Example workflows

Basic chat completion

[Manual Trigger] -> [OpenAI Chat] -> [Output]

OpenAI Chat node:
- Credential: NanoGPT
- Model: openai/gpt-5.2
- Messages: User message from input

Document summarization

[Webhook] -> [HTTP Request (fetch doc)] -> [OpenAI Chat] -> [Respond to Webhook]

OpenAI Chat node:
- Model: google/gemini-3-flash-preview
- System: Summarize the following document concisely
- User: {{ $json.documentContent }}

Multi-model comparison

[Input] -> [OpenAI Chat (GPT-4o)] -\
                                  -> [Merge] -> [Compare Results]
[Input] -> [OpenAI Chat (Claude)] -/

Troubleshooting

IssueSolution
401 UnauthorizedVerify the API key and that your account has credits
Invalid API KeyEnsure there are no extra spaces when copying the key
Model not foundDouble-check the model name on the pricing page
Connection timeoutConfirm the Base URL is https://nano-gpt.com/api/v1
Rate limitedAdd a delay between requests or upgrade your plan

Advanced: HTTP Request node

If you need full control over parameters, use the HTTP Request node:
  1. Add HTTP Request
  2. Set:
    • Method: POST
    • URL: https://nano-gpt.com/api/v1/chat/completions
    • Authentication: Header Auth
    • Header Name: Authorization
    • Header Value: Bearer sk-nano-YOUR-API-KEY
    • Body Content Type: JSON
    • Body:
{
  "model": "openai/gpt-5.2",
  "messages": [
    { "role": "user", "content": "{{ $json.prompt }}" }
  ]
}