📄 Documents: freegpthub.readthedocs.io 学习收获更多有趣的内容, 欢迎关注微信公众号:Charles的皮卡丘 📢 What's New 2025-12-24: Released FreeGPTHub v0.1.0, adding support for nine endpoints. 🤖 Introduction A truly free, unified GPT API gateway—unlike “fake-free” alternatives that hide paywalls behind quotas, trials, or mandatory top-ups. ⚠️ Disclaimer This repository (including code, models, data, documentation, and any derivatives,…
2025-12-24: Released FreeGPTHub v0.1.0, adding support for nine endpoints.
🤖 Introduction
A truly free, unified GPT API gateway—unlike “fake-free” alternatives that hide paywalls behind quotas, trials, or mandatory top-ups.
⚠️ Disclaimer
This repository (including code, models, data, documentation, and any derivatives, collectively the “Project”) is provided for non-commercial purposes only, such as personal learning, academic research, and teaching/demo.
Commercial use of any kind is strictly prohibited, and no commercial license or collaboration will be granted.
Commercial use includes, but is not limited to:
Using the Project in any product or service that is directly or indirectly monetized;
Providing paid services/consulting/training or delivering it to clients based on the Project;
Integrating the Project into commercial software/systems (including internal corporate use);
Redistributing or sublicensing the Project for commercial purposes;
Any use, reproduction, modification, distribution, deployment, or sale for commercial advantage.
In case of violation, the author reserves all rights to pursue legal action.
🧩 Supported GPT Models
The models currently supported by FreeGPTHub are as follows:
Please note that the APIs in FreeGPTHub mainly rely on free endpoints scraped from the public internet, so their speed and stability cannot be guaranteed.
🧪 Playground
Here are some projects built on top of FreeGPTHub,
You have three installation methods to choose from,
# from pip
pip install freegpthub
# from github repo method-1
pip install git+https://github.com/CharlesPikachu/FreeGPTHub.git@main
# from github repo method-2
git clone https://github.com/CharlesPikachu/FreeGPTHub.git
cd FreeGPTHub
python setup.py install
🚀 Quick Start
FreeGPTHub provides a unified Python interface to call multiple LLM / MLLM endpoints via provider-specific *Endpoints clients.
You create a ChatRequest, pick an endpoint client, and call send().
Notes:For security reasons, all free API keys collected by this project have been encrypted.Therefore, if you’d like to use this project, please first follow the WeChat Official Account “Charles的皮卡丘”, then send the message “FreeGPTHub” via private chat in the backend to obtain the key.
Supported Endpoint Clients (What you can import)
The repository currently lists these endpoint clients:
AlibabaQwenEndpoints
BaiduQianfanEndpoints
DeepSeekEndpoints
DoubaoEndpoints
IFLYTEKSparkEndpoints
MiniMaxEndpoints
ModelScopeEndpoints
OpenAIGPTEndpoints
ZhipuGLMEndpoints
You can switch providers by swapping the client class, while keeping the same ChatRequest.
Your First Call (iFLYTEK Spark)
This is the simplest “works-first” example from the repository.
from freegpthub import ChatRequest, IFLYTEKSparkEndpoints
# 1) prepare your request
req = ChatRequest(text="10 * 10 = ?")
# 2) create a client
spark_client = IFLYTEKSparkEndpoints(aes_gem_key=xxx)
# 3) call an endpoint version (provider-specific)
resp = spark_client.send(req=req, version="lite")
print(resp.text)
# 4) try another version
resp = spark_client.send(req=req, version="4.0Ultra")
print(resp.text)
If you get errors about aes_gem_key, please first follow the WeChat Official Account “Charles的皮卡丘”, then send the message “FreeGPTHub” via private chat in the backend to obtain the aes_gem_key.
Some paid models use the free credits from the accounts we created on the corresponding platforms.
If you see an error, it means those free credits have been exhausted.
You can switch to your own API key to continue using it.
Switch Providers (Same Pattern)
Example: ModelScope DeepSeek. The calling pattern is the same: create ChatRequest, create client, call send().
openai (Dict[str, Any]): Configuration for OpenAI SDK–style endpoints. You may pass model or messages here; if not provided, the library uses version as the model name and uses a default messages=[{"role":"user","content": req.text}].
websocket (Dict[str, Any]): Reserved for websocket-style endpoints (default {"client": {}}).
extra_payload (Dict[str, Any]): Provider-specific extra payload (default {}).
meta (Dict[str, Any]): Any metadata you want to carry for logging/debugging (default {}).
send() is the core entry point for all endpoint clients.
Arguments:
req (Any): In practice, a ChatRequest. The library infers its IO type via inferio(req).
version (Optional[str]): Which variant to use. If omitted, it falls back to self.default_version. Must be registered in self.variants, otherwise ValueError.
api (Optional[str]): Force a specific API route (by name) within the chosen variant. If not provided, the endpoint automatically selects the highest-priority compatible API.
request_overrides (dict): Extra request options passed into the handler (implementation-specific).
EndpointRegistry (Discoverability)
EndpointRegistry collects all endpoints and can:
listall(): return describe() for every registered endpoint
findvariantsbyio(io): find endpoints/versions supporting a given IO type (string tag like "T2T" or a ModelIOType)
get(provider, model): filter endpoints by provider/model
In the project, REGISTERED_ENDPOINTS is pre-populated by registering multiple endpoint classes.
from freegpthub import REGISTERED_ENDPOINTS
print(REGISTERED_ENDPOINTS.listall())
评论