FreeLLMAPI Universal Provider Patcher
An interactive CLI utility to dynamically inject any custom OpenAI-compatible AI provider and its models into your self-hosted FreeLLMAPI instance in one click.

Why this exists
FreeLLMAPI is a fantastic local proxy that stacks free-tier LLM endpoints. However, its provider catalog is deliberately static. If you want to add a custom OpenAI-compatible API provider (like Together AI, DeepInfra, private vLLM, or LM Studio endpoints), you normally have to manually edit 5 different files spanning TypeScript types, database migrations, backend schemas, and React components.
This tool automates that entire process. It asks you 4 simple questions in the terminal, applies robust line-by-line injections to all necessary files, clears the compiled cache, and rebuilds the project.
⚠️ Important Financial Safety Warning
Before adding any custom provider, double-check that it is strictly free or has active free trial credits.
Some aggregators (like OpenRouter) do not require a card, but if you accidentally route to a paid model, your balance can slip into a minor overdraft (e.g., $-0.02). If your balance goes below zero, the provider will block your entire API key, preventing you from using even their completely free models until you top up.
Rule of thumb: Do not link any bank cards to the accounts you use with FreeLLMAPI.
How it works
The script scans and safely patches the following 5 files in your FreeLLMAPI workspace:
shared/types.ts — Appends your new provider’s ID to the static Platform TypeScript union type.
client/src/pages/KeysPage.tsx — Injects your new provider option into the React frontend dropdown menu.
server/src/providers/index.ts — Registers your OpenAI-compatible provider inline with the same architecture as the native ones.
server/src/routes/keys.ts — Adds your provider ID to the Zod backend request validation schema.
server/src/db/index.ts — Generates a separate, isolated database migration function (e.g., migrateModels_yourprovider(db)) to safely seed your custom models with healthy default rate-limits on server startup.
Installation & Usage
-
Copy patch_provider.js and patch.bat from this repository and paste them into the root directory of your cloned freellmapi folder (where package.json lives).
-
Double-click patch.bat (on Windows) or run the script in your terminal (on macOS/Linux):
node patch_provider.js
-
Answer the 4 interactive questions:
- Provider ID: The technical identifier (e.g.,
together).
- Display Name: The label shown in the UI (e.g.,
Together AI).
- API Base URL: The endpoint (e.g.,
https://api.together.xyz/v1).
- Model IDs: Comma-separated model IDs (e.g.,
meta-llama/Llama-3-70b-chat-hf).
-
The script will automatically patch all files, clear the server compiled cache, and run npm run build.
-
Start your application as usual. Open the dashboard, go to the Keys page, and you will see your brand-new provider ready to be configured!
Acknowledgements
This tool is an unofficial community extension. A huge thank you and full credits to the creators and contributors of the original FreeLLMAPI project for their incredible work building such a lightweight, local-first API aggregator!
If you find this patcher helpful, please make sure to visit their repository, check out their work, and drop a star on their project (and maybe on this repository too, if you have any stars left, of course! 🌟).
License
This project is licensed under the MIT License. It is designed to extend FreeLLMAPI under the terms of its original open-source license.
评论