[UNTESTED] [syafrieyunizar/grok-web2api] 1 endpoint(s)
ChatGPT
API Proxy/ChatGPT
2,136 characters
Status: [UNTESTED]
Endpoints found:
http://localhost:6905/v1/chat/completions
Source: https://github.com/syafrieyunizar/grok-web2api
# grok-web2api
Grok Web (grok.com) → OpenAI-compatible API proxy.
Scrapes grok.com's web interface and exposes it as a standard `/v1/chat/completions` endpoint. Single-file Python, minimal deps, systemd-ready.
## Features
- **OpenAI Compatible**: Drop-in replacement for `/v1/chat/completions` and `/v1/models`
- **Direct API**: POST to `/rest/app-chat/conversations/new` with `curl_cffi` TLS impersonation
- **NDJSON Streaming**: Parses Grok's NDJSON stream → SSE chunks
- **Cloudflare Bypass**: Chrome TLS fingerprint via `curl_cffi`
- **Single File**: One Python file, one dependency (`curl_cffi`)
- **API Key Auth**: Protect your endpoint with `api_keys`
- **systemd Service**: Auto-start & auto-restart included
## Quick Start
```bash
pip install -r requirements.txt
python grok_web2api.py
```
## Configuration
```bash
cp config.example.json config.json
# Edit config.json — set sso_token and api_keys
```
### Getting SSO Token
1. Open [grok.com](https://grok.com) in your browser, login with X.com account
2. Open DevTools (F12) → Application → Cookies → `grok.com`
3. Copy the value of the `sso` cookie
4. Paste it into `config.json` as `sso_token`
### config.json
```json
{
"port": 6905,
"host": "0.0.0.0",
"host_url": "https://grok.com",
"default_model": "grok-4",
"api_keys": ["sk-grok"],
"sso_token": "YOUR_SSO_COOKIE_VALUE",
"impersonate": "chrome131"
}
```
| Option | Default | Description |
|--------|---------|-------------|
| `port` | `6905` | HTTP port |
| `host_url` | `https://grok.com` | Grok backend |
| `api_keys` | `[]` | API keys to accept (empty = accept anything) |
| `sso_token` | `null` | Grok SSO cookie value from browser |
| `proxy` | `null` | HTTP proxy |
| `history_disabled` | `true` | Use temporary conversations |
| `impersonate` | `chrome131` | curl_cffi TLS fingerprint |
| `default_model` | `grok-4` | Default model slug |
## Client Configuration
### curl
```bash
curl http://localhost:6905/v1/chat/completions \
-H "