General Introduction
Grok-Mirror is a program based on the Serverless rapid deployment Grok3 domestic mirror site The Grok Mirror Station built to be operable. It allows users to deploy a local Grok kiosk with one click via Docker. grok is an AI assistant launched by xAI, and Grok-Mirror allows users to use Grok's features without visiting xAI's official website through mirroring technology. The project supports multi-user management and provides an API interface compatible with the OpenAI format. It has a variety of built-in Grok models that users can run locally, eliminating network restrictions. In addition, it also supports rapid deployment using idle Serv00 servers. The whole process is simple and suitable for individuals, teams or developers.
No direct access within the country Grok , utilizing this issue to provide Grok mirror sites. The program can quickly cash through Google Ads, only need to configure GOOGLEADS system variables. About 50 sets of accounts steadily support 2,000 people and earn 3 knives of revenue per day. Or use this method to attract traffic to cash on their own.
Function List
- One-click deployment: quickly build local Grok kiosks via Docker or Serv00.
- Multi-user support: allows multiple people to use it at the same time, and administrators can manage accounts and permissions.
- API Interface: Provides
/v1/chat/completions
Chat API, consistent with OpenAI format. - Multi-model selection: support
grok-2
,grok-3
and many other models. - Wall-free use: no need to rely on external networks after local deployment.
- Token Management: Supports entering Sso Token and even batch importing multiple Token.
- Data caching: Built-in caching mechanism to improve response speed.
- Temporary Chat: The API supports temporary sessions without record keeping.
Using Help
Installation process (Docker way)
Grok-Mirror depends on Docker to run by default, the installation steps are as follows:
- Installing Docker
Ensure that Docker is installed on your device.Windows and Mac users can download Docker Desktop, Linux users run it:sudo apt update && sudo apt install docker.io -y
Check the version:
docker --version
- Pulling Mirrors
Enter it in the terminal:docker pull dairoot/grok-gateway:latest
This will download the latest version of the Grok-Mirror image.
- Starting services
Execute the following command to run the container:docker run --rm -p 50005:8080 -v grok_gateway_db:/app/.cache_data dairoot/grok-gateway:latest
-p 50005:8080
: Maps container port 8080 to local port 50005.-v grok_gateway_db:/app/.cache_data
: Persistent storage of data.
After startup, access thehttp://127.0.0.1:50005
See if the service is running.
- Domain name configuration (optional)
If extranet access is required, refer to the full deployment process to configure the domain name.
Rapid deployment tutorial (Serv00 approach)
If you have an idle Serv00 server, you can utilize it to quickly deploy Grok-Mirror.Here are the detailed steps:
I. Configuration in the Serv00 backend
- Configure the port
Log in to the Serv00 backend, enter the "Firewall" settings, and add a custom port (e.g.50006
).
- Configuring Web Services
Fill in the custom domain name in the backend (e.g.yourdomain.serv00.net
) and the port you just created to complete the web service setup.
- Editing Web Services
Click on the web service you just created and selectManage -> Details
, enter edit mode and make sure the settings are correct.
Second, download Grok mirror station program
Download the Grok program by running the following command from the Serv00 terminal:
curl -L -o grok_gateway https://dairoot.cn/2025/03/06/serv00-grok/grok_gateway_freebsd_amd64
III. Operational procedures
- execute authority
Enter the command:chmod +x grok_gateway
- Starting services
Start the program with a custom port, e.g. port50006
::./grok_gateway -p 50006
IV. Access services
After deployment is complete, enter the custom domain name in your browser (e.g.http://yourdomain.serv00.net:50006
) to access the Grok service.
Configuration steps
- Log in to the backstage
Access the service address (e.g.http://127.0.0.1:50005
) to get to the login page. The default administrator password needs to be passed through the environment variableADMIN_PASSWORD
Settings, for example:docker run --rm -p 50005:8080 -e ADMIN_PASSWORD=yourpassword -v grok_gateway_db:/app/.cache_data dairoot/grok-gateway:latest
The Serv00 method accesses the settings directly after the domain name.
- Enter Sso Token
Get Sso Token method:- Log on to the xAI website (https://x.ai).
- Press F12 to open Developer Tools and switch to the Network tab.
- Refresh the page and find the
new-chat
request, copy the Sso Token in the cookie. - Enter and save in the background "Token Management". Batch entry is supported, see later.
- test function
Once the configuration is complete, go to the home page and enter text to test the dialog. If the result is returned, the service is normal.
API Usage
Grok-Mirror provides API support at/v1/chat/completions
The
- Basic requests
Tested with cURL:curl --location "http://127.0.0.1:50005/v1/chat/completions" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer YourSsoToken" \ --data '{"model": "grok-2", "messages": [{"role": "user", "content": "你好!"}]}'
- Environment variable configuration
This can be done with the environment variableAUTHORIZATION
Set the Token:docker run --rm -p 50005:8080 -e AUTHORIZATION=YourSsoToken -v grok_gateway_db:/app/.cache_data dairoot/grok-gateway:latest
- Support Models
API Supportgrok-2
,grok-3
and other models, specifymodel
Parameter switching.
Featured Function Operation
- Batch Token Entry
invocations/api/batch-add-grok-token
Interface:curl -X POST "http://127.0.0.1:50005/api/batch-add-grok-token" \ -H "Content-Type: application/json" \ -d '{"sso_token_list": ["token1", "token2"]}'
- login interface
- General Login:
curl -X POST "http://127.0.0.1:50005/api/login" \ -H "Content-Type: application/json" \ -d '{"user_name": "test", "email_md5": "md5value"}'
- V2 Login (with Token):
curl -X POST "http://127.0.0.1:50005/api/login-v2" \ -H "Content-Type: application/json" \ -d '{"user_name": "test", "sso_token": "YourSsoToken"}'
- Get Grok List
View available instances:curl -X POST "http://127.0.0.1:50005/api/get-grok-list" \ -H "Content-Type: application/json" \ -d '{"page": "1", "page_size": "10"}'
system variable
The following environment variables are supported by Grok-Mirror for customizing service configuration. These variables can be configured when starting a Docker container or Serv00 program via the-e
parameter is passed in, e.g.docker run -e 变量名=值
The
categorization | variable name | typology | default value | descriptive |
---|---|---|---|---|
API Related | ADMIN_PASSWORD |
String |
None |
Password for accessing the administration backend. You need to specify it manually if it is not set, otherwise you cannot log in to the backend. |
AUTHORIZATION |
String |
None |
API access key for polling a list of multi-account Sso Token. It is recommended to set this to automatically manage Token. | |
ENABLE_MIRROR_API |
Boolean |
true |
Whether to enable API access. Set tofalse shut down/v1/chat/completions Interface. |
|
MIRROR_API_PREFIX |
String |
None |
API access prefix, e.g. set toapi After that, the interface changes to/api/v1/chat/completions . Configuration is recommended to differentiate between paths. |
|
API_HATD |
Boolean |
true |
Whether to enable temporary chat mode. The API does not save chat logs when enabled, suitable for testing or privacy needs. | |
system variable | PROXY_URL_POOL |
String |
None |
Proxy pool links with multiple proxies separated by commas. The format is as followshttp://username:password@ip:port The |
HOST |
String |
None |
Service domain address for functions such as API return images. For examplehttps://example.com The |
|
GOOGLEADS |
String |
None |
Google Adsense advertising code for embedding ads on a page. |
usage example
- Setting variables the Docker way
Add the environment variable when you start the container:
docker run --rm -p 50005:8080
-e ADMIN_PASSWORD=yourpassword
-e AUTHORIZATION=YourSsoToken
-v grok_gateway_db:/app/.cache_data
dairoot/grok-gateway:latest
- Setting variables in Serv00 mode
Before running the program, export the variables through the terminal:
export ADMIN_PASSWORD=yourpassword
export AUTHORIZATION=YourSsoToken
./grok_gateway -p 50006
application scenario
- Personal Learning Assistant
After deploying Grok-Mirror, users can ask questions and get answers to their knowledge at any time, without the need for internet access to xAI. - Team AI Tools
Teams share a single local Grok kiosk with multi-user management capabilities to improve collaboration efficiency. - Development test platforms
Developers use API interfaces to test AI functionality, develop new applications or integrate existing systems.
QA
- Is Grok-Mirror free?
The project itself is free and open source, but requires an xAI Grok account and Sso Token. - Why did the API request fail?
probeAuthorization
is correct, perhaps the Token is expired or not configured. - What models are supported?
be in favor ofgrok-2
,grok-3
and many other models, depending on the API return.