Library / Building Blocks & Utilities
Building Blocks & Utilities
Create a Free OpenAI-Compatible API with GitHub Models
When a chat message or webhook request arrives, it proxies chat completions to GitHub Models so n8n AI workflows can use them free.
What it does
## Try It Out! ### This n8n template shows you how to connect Github's Free Models to your existing n8n AI workflows. Whilst it is possible to use HTTP nodes to access Github Models, The aim of this template is to use it with existing n8n LLM nodes - saves the trouble of refactoring! Please note, Github states their model APIs are not intended for production usage! If you need higher rate limits, you'll need to use a paid service. ### How it works * The approach builds a custom OpenAI compatible API around the Github Models API - all done in n8n! * First, we attach an OpenAI subnode to our LLM node and configure a new OpenAI credential. * Within this new OpenAI credential, we change the "Base URL" to point at a n8n webhook we've prepared as part of this template. * Next, we create 2 webhooks which the LLM node will now attempt to connect with: "models" and "chat completion". * The "models" webhook simply calls the Github Model's "list all models" endpoint and remaps the response to be compatible with our LLM node. * The "Chat Completion" webhook does a similar task with Github's Chat Completion endpoint. ### How to use * Once connected, just open chat and ask away! * Any LLM or AI agent node connected with this custom LLM subnode will send requests to the Github Models API. Allowing your to try out a range of SOTA models for free. ### Requirements * Github account and credentials for access to Models. If you've used the Github node previously, you can reuse this credential for this template. ### Customising this workflow * This template is just an example. Use the custom OpenAI credential for your other workflows to test Github models. ### References * https://docs.github.com/en/github-models/prototyping-with-ai-models * https://docs.github.com/en/github-models ### Need Help? Join the Discord or ask in the Forum! Happy Hacking!
The steps
- Aggregate
- Github Models
- Github Chat Completions
- n8n Webhooks
- Chat Response
- Models Response
- Powered By Github Models
- When chat message received
- GET models
- POST ChatCompletions
- Is Agent?
- Agent Response
Similar automations
Tasks & Project ManagementDraft product review reply JSON via webhook with OpenAI-compatible LLMs11 stepsAlerts & NotificationsNotify Discord of New Epic Games Free Games20 stepsCode, Git & Developer ToolsLoad Prompts from GitHub and Fill Variables with Ollama13 stepsCode, Git & Developer ToolsLoad Prompts from GitHub into n8n with Ollama13 steps