Grok-Mirror provides OpenAI-compatible RESTful API interface, the use of the process is as follows:
Basic API Calls
Request endpoints:/v1/chat/completions
Example cURL command: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": "你好!"}]}'
Description of key parameters
- Authorization: Required SSO Token Authentication Header
- model: Optionally available grok-2/grok-3 models.
- messages: Conversation history array (needs to contain role and content)
Advanced Features
- ad hoc chat: Enable
API_HATD
System variables do not keep records - batch operation: By
/api/batch-add-grok-token
Batch Import Token - Model List::
/api/get-grok-list
Getting Available Instances
It is recommended that developers pass theMIRROR_API_PREFIX
Customize the API path prefix to avoid conflicts with other services.
This answer comes from the articleGrok-Mirror: one-click deployment of a profitable Grok mirror siteThe