ShenwenAI
GROK_TEXT_API

Grok Heavy Setup

Create a dedicated Grok Heavy API key to use Grok 4.6 and Grok 4.5. Requests go through https://api.shenwenai.com/v1 for ShenwenAI authentication and billing.

Codex uses the standard HTTP Responses API. Responses WebSocket is intentionally not enabled for this provider.

Supported model IDs

Copy these model IDs into config files, API request bodies, or any OpenAI-compatible client that asks for a model name.

API_KEY_REQUIRED

Prepare your API key first

1. Go to your account page

After logging in, create or copy an API key from your account page. It looks like sk-or-v1-xxxxxxxxxxxx. Treat it like a password.

Go to account page

2. Create an API key and choose a channel

Select Create API Key, enter a recognizable name, then choose the channel that fits your use case:

Stable · 0.22x (Pro pool)
Prioritizes stability for OpenAI (Codex), OpenAI-compatible clients, and Claude Code. Recommended for long-running or important text workloads.
Economy · 0.09x (Plus pool)
Prioritizes price for OpenAI (Codex) and OpenAI-compatible clients. Recommended for everyday development, learning, testing, and cost-sensitive text workloads.

For images, create a separate OpenAI image key or Grok image key. Text and image purposes cannot be mixed in one key.

3. Confirm the Base URL

Use https://api.shenwenai.com/v1 for Codex and OpenAI-compatible clients.

https://api.shenwenai.com/v1

Do not share your API key with others or commit it to GitHub, GitLab, or any public repository.

Choose your system first

The commands below will switch based on your selected system.

Create a Grok Heavy API key

Open API Key management, select Create API Key, then choose Grok Heavy · 30% of official price. Keep the capabilities needed by Codex, OpenAI-compatible clients, or Claude Code.

A Grok Heavy key cannot call GPT or image models. Create separate keys for other uses.

Create an isolated Codex folder

macOS / Linux
bash
mkdir -p ~/.codex-shenwen-grok

Write config.toml

Create ~/.codex-shenwen-grok/config.toml and paste the content below. Do not add supports_websockets.

toml
model_provider = "Grok"
model = "grok-4.6"
disable_response_storage = true

[model_providers.Grok]
name = "Grok"
base_url = "https://api.shenwenai.com/v1"
wire_api = "responses"
requires_openai_auth = true

Write auth.json

Replace the placeholder with your ShenwenAI Grok API key. Treat auth.json like a password and never commit it.

json
{ "OPENAI_API_KEY": "sk-or-v1-your-key" }

Start Codex

macOS / Linux
bash
CODEX_HOME="$HOME/.codex-shenwen-grok" codex --model grok-4.6

This isolated CODEX_HOME leaves the ChatGPT or Codex login under ~/.codex unchanged.

OpenAI-compatible request

bash
curl https://api.shenwenai.com/v1/chat/completions \
  -H "Authorization: Bearer sk-or-v1-your-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"grok-4.6","messages":[{"role":"user","content":"Hello"}],"stream":true}'

Troubleshooting

400 / unsupported_model: use exactly grok-4.6 or grok-4.5.

403 / capability denied: confirm that this is a Grok Heavy key with the capability required by your client.

404: make sure the Base URL includes /v1. Responses WebSocket is intentionally not exposed.