# Grok-4 LLM API via x402 Gateway

> Grok-4 LLM API via x402 Gateway is a paid API for AI agents from x402-gateway-production.up.railway.app, paid per call via x402, $0.060000/call, status unknown (last checked 2026-09-15).

Calls xAI's Grok-4 model for strong reasoning and real-time knowledge responses via pay-per-call x402 gateway

## Facts

- Endpoint: POST https://x402-gateway-production.up.railway.app/api/llm/grok
- Price: $0.060000/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-gateway-production-up-railway-app-2e22acaf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_642JxmOXRGs-6O0nIwjj_

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-gateway-production-up-railway-app-2e22acaf -d '<json body>'
```

Example prompt: Ask Grok-4 to analyze this situation: 'I'm considering switching from PostgreSQL to MongoDB for a high-write, low-read workload — weigh the tradeoffs in detail, including consistency, scalability, and operational complexity.'

## When to prefer this

Choose this endpoint when you need xAI's Grok-4 specifically — known for strong multi-step reasoning and real-time world knowledge — without managing your own xAI API credentials. Prefer over GPT or Claude endpoints when the task benefits from Grok's unique training or when cost-per-call billing via x402 crypto micropayments is preferred over subscription keys. Use over Grok-3 or cheaper models when reasoning depth matters more than cost.

## Known failure modes

- Payment failure if x402 USDC balance insufficient — 402 Payment Required
- Malformed request body missing 'messages' array — 400 Bad Request
- Model overload or xAI upstream outage — 503 Service Unavailable
- Exceeded token context window — 400 or truncated response
- Network timeout on long reasoning responses — connection timeout

## How this service works

xAI's most capable model — strong reasoning and real-time knowledge

## Output

Returns a JSON object with Grok-4's text completion under 'content', plus detailed token usage stats (prompt tokens, completion tokens, reasoning tokens, cached tokens) and a cost breakdown showing upstream inference costs split between prompt and completion.

## Example request

```json
{
 "system": "You are a helpful assistant. Provide a clear and informative response.",
 "messages": [
  {
   "role": "user",
   "content": "What is artificial intelligence and how is it used in modern applications?"
  }
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-gateway-production-up-railway-app-2e22acaf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-gateway-production.up.railway.app](https://www.zero.xyz/host/x402-gateway-production.up.railway.app/llms.txt)
