API for Grok, implemented in Python
Top 63.8% on sourcepulse
This project provides a Python-based API wrapper for Grok, designed for developers and researchers needing to integrate Grok's AI capabilities into their applications. It offers a standardized OpenAI-compatible API, supporting text generation, image generation, search, and reasoning, with features like automatic Cloudflare bypass and true streaming.
How It Works
The API acts as a proxy, translating requests into the format expected by Grok's official website. It employs Docker for deployment and includes mechanisms to automatically bypass Cloudflare's "shield" protection, provided the user's IP is not flagged. For image generation, it integrates with PicGo or TUMY image hosting services to handle image uploads and streaming. The system supports multiple Grok accounts with automatic round-robin and load balancing.
Quick Start & Requirements
docker run -it -d --name grok2api_python -p 3000:3000 -e SSO=your_sso yxmiler/grok2api_python:latest
IS_CUSTOM_SSO
is true), optional CF_CLEARANCE
cookie, optional image hosting API keys (PicGo/TUMY) for streaming image generation.Highlighted Details
grok-2-imageGen
, grok-3-imageGen
), search (grok-2-search
, grok-3-search
), deep search (grok-3-deepsearch
), and reasoning (grok-3-reasoning
).Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
CF_CLEARANCE
cookie is IP-bound.2 weeks ago
1 day