Use this n8n workflow to create an OpenAI-compatible API endpoint that proxies requests to GitHub's free AI models, enabling their use within standard n8n AI agent configurations.
Download this n8n workflow template and start using it instantly.
AI developers prototyping solutions and seeking free models.
n8n users who want to integrate GitHub Models without altering existing LLM nodes.
Automation specialists needing flexible, self-hosted alternatives to paid OpenAI endpoints.
Users looking for advanced examples of customizing API interactions within an n8n workflow.
Leveraging free, state-of-the-art AI models often requires specialized API calls, which can complicate integration with standard tools like n8n's built-in LLM nodes. This n8n workflow solves that problem by acting as an OpenAI-compatible proxy. It intercepts standard OpenAI API calls (/models and /chat/completions) directed to a custom n8n webhook URL and forwards them to the GitHub Models API using the HTTP Request n8n node. Crucially, the n8n workflow then remaps the GitHub response data structure back into the format expected by the originating n8n node. This approach allows users to configure a custom OpenAI credential in n8n, pointing its Base URL to this local proxy, thereby accessing powerful free models using standard n8n templates and integrations.
This comprehensive n8n workflow operates on two primary webhook endpoints that mimic the OpenAI API structure:
/github-models/models): This is triggered when an LLM n8n node attempts to list available models. The n8n trigger Webhook node immediately passes control to the Github Models HTTP Request n8n node, which fetches the full model catalog from GitHub. The subsequent Aggregate node ensures all data is collected before the Models Response node uses a complex JSON expression to transform the GitHub data structure into the object: list format required by OpenAI API clients./github-models/chat/completions): This endpoint, triggered by a POST request, handles actual inference requests. The POST ChatCompletions n8n trigger passes the request body (containing the model ID, messages, and stream flag) to the Github Chat Completions HTTP Request n8n node. This n8n node makes the corresponding request to the GitHub inference URL.Is Agent? If n8n node, which checks the incoming JSON payload for the stream flag. If streaming is requested (typical for n8n AI agents), the Agent Response n8n node responds with the raw text data. If streaming is false, the Chat Response n8n node formats the response as JSON. This robust n8n workflow ensures compatibility across different integration methods.To deploy this n8n workflow and access GitHub Models:
Github Models and Github Chat Completions HTTP Request n8n nodes.https://n8nurl>/webhook/github-models (or adjust based on the path configured in the Webhook nodes). Note that this connection is typically required to use the production webhook URL. GET models (Webhook n8n node): Acts as the primary n8n trigger for model listing requests. It listens for GET requests at /github-models/models.
POST ChatCompletions (Webhook n8n node): The core n8n trigger for chat inference, listening for POST requests at /github-models/chat/completions.
Github Models (HTTP Request n8n node): Fetches the model list from the external GitHub Models API. Uses a GitHub credential for authentication and includes necessary headers (X-GitHub-Api-Version).
Models Response (Respond To Webhook n8n node): Essential for compatibility. It uses a JavaScript expression to restructure the GitHub model response data ($json.data) into the list format expected by standard OpenAI n8n node connections.
Github Chat Completions (HTTP Request n8n node): Sends the chat completion payload, dynamically generated from the incoming webhook body, to the GitHub inference endpoint.
Is Agent? (If n8n node): Determines the response type based on the stream parameter in the request payload. This is vital for correctly handling streaming responses required by certain n8n AI agent setups.
Agent Response handles streaming requests as plain text, while Chat Response handles non-streaming requests as JSON. This completes the custom n8n workflow.Use this powerful n8n workflow to automate logistics. Read local Excel or CSV files and automatically create detailed delivery tasks in Onfleet using specific n8n node mapping.

Use this powerful n8n workflow to automatically create Notion tasks from incoming Telegram messages (text or voice) using GPT-3.5 for intelligent data extraction and scheduling. Deploy this n8n template now.

Master complex nested looping challenges in n8n by utilizing sub-workflows and the Execute Workflow n8n node. Download this reliable n8n template for modular data processing logic.

Use this efficient n8n workflow template to convert incoming HTML strings into professional, customized PDF documents instantly via a self-hosted Gotenberg service. A key n8n automation for document management.


Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at [email protected] LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk







































