70% off Wan3.0 Standard and 50% off Wan3.0 Prime. Try Wan3.0

Grok 4.7 API

Frontier reasoning model for coding, agentic tasks, and knowledge work

Get an API key
Input per 1M
from$2.00
Cached input per 1M
from$0.50
Output per 1M
from$6.00
Context window
500K

Call Grok 4.7 in one request

Runware's endpoint takes the OpenAI Chat Completions format, so the OpenAI SDK works as it is. Change the base URL, key, and model ID.

Request
import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["RUNWARE_API_KEY"],
    base_url="https://api.runware.ai/v1",
)

stream = client.chat.completions.create(
    model="xai:[email protected]",
    messages=[
        {"role": "user", "content": "What is the capital of France?"},
    ],
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    if chunk.usage:
        print("\n", chunk.usage)

Usage and cost come back with the response. The stream ends with the request's token counts and its cost, so there is no second call to make.

About Grok 4.7

Grok 4.7 is xAI's frontier model for coding, agentic tasks, and knowledge work, built to work longer on difficult tasks and check its own work more carefully. It reads text and images, calls tools, and offers reasoning effort from low to xhigh, with a 500,000-token context window and no fixed output limit. It suits software engineering, multi-step agents, and document-heavy analysis.

Developer
xAI
Released
21 Sep, 2026
Input
Text, Image
Context window
500K tokens
Max output
500K tokens
API
OpenAI Chat Completions

Already on another provider?

Code that uses the OpenAI SDK moves over with three changes: the base URL, the API key and the model ID. Moving production traffic? We'll help you plan the switch.

Read the docs

Grok 4.7 pricing

Pay per token with prepaid credits, on the same key and billing as every other model on Runware. No subscription.

< 200K context

Input
$2.00/1M tokens
Cached input
$0.50/1M tokens
Output
$6.00/1M tokens

≥ 200K context

Input
$4.00/1M tokens
Cached input
$1.00/1M tokens
Output
$12.00/1M tokens

Start on demand. Scale on dedicated.

Call your first model in minutes, or tell us about your workload and we will size dedicated capacity for it.

Get an API key