Grok 4.7
Input $1.20, Output $3.60, Per 1M tokens$1.20 / $3.60per 1M
Not enough data
SpaceXAI
Grok 4.7 is SpaceXAI’s advanced AI model for coding and professional knowledge work, built to tackle complex, multi-hour tasks with improved self-verification and long-context handling. It strengthens software engineering, document creation, and presentation workflows while maintaining Grok 4.6’s speed and pricing.Your use is subject to SpaceXAI's Terms & Privacy Policies.
Get API key- Claude Code
- View API reference
- 3
const result =streamText({
- 6 })
Providers
Read $0.30/M
$1.20/M
$3.60/M
500K
Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docsfor more info. Using a provider means you agree to their terms, listed under Legal.
500K
+2 more
$5/K
+2 more
Getting started
2
import'dotenv/config';
1
import{ generateText }from'ai';
10
console.log(result.text);
Install the AI SDK (pnpm add ai dotenv), create an API key from the API Keys page, and set it asAI_GATEWAY_API_KEYin your environment. Full setup is covered in the text generation quickstart.
13 main().catch(console.error);
5
const result =awaitgenerateText({
8
});
11 }
4
asyncfunctionmain(){
7
prompt:'Why is the sky blue?',
6
model:'spacexai/grok-4.7',
Call Grok 4.7 through AI Gateway with the AI SDK generateText and streamText functions, or through the OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages APIs by changing the base URL. AI Gateway authenticates the request and routes it to an available provider.
The same Grok 4.7 request in each API format AI Gateway supports.
Parameter
});
7
system:'You are a concise technical assistant.',
14- 4
asyncfunctionmain(){
- 2
import'dotenv/config';
- providerOptions
- maxOutputTokens
Type
8
prompt:'Summarize the tradeoffs between static generation and SSR.',
11- 9
maxOutputTokens:1024,
- 12
console.log(result.text);
- 15 main().catch(console.error);
- reasoning
Yes
Model ID in the form creator/model, e.g. spacexai/grok-4.7. AI Gateway routes the request to an available provider.
3- Description
- No
- Record
- No
Input limits
Sent as image parts in messages; counts as input tokens
Formats
Prompt and response share the 500K-token context window
Limits
Sources
URL, base64, Uint8Array
Input
Text
—
—
—
Max count
—
Provider options
Learn more in the AI SDK xai provider docs.
Max size
—
—
Image
Our Services
7
prompt:'Why is the sky blue?',
Parameter
Restrict routing to these provider slugs. Requests fail over only within the listed providers.
providerOptions.gateway.only
Preferred provider order. Listed providers are tried first; unlisted providers remain available as fallbacks.
Type
Required
providerOptions.gateway.sort
string[]
providerOptions.gateway.order
Route only to providers with a zero-data-retention policy for this model.
No
Description
string[]
'cost' | 'ttft' | 'tps'
Routing across providers
providerOptions.gateway.zeroDataRetention
boolean
No
No
No
Our Services
Reasoning
AI SDK v7Chat CompletionsResponses APIMessages API
Brand & Design
7
prompt:'Explain the Monty Hall problem step by step.',
2
import'dotenv/config';
5
const result =awaitgenerateText({
4
asyncfunctionmain(){
6
model:'spacexai/grok-4.7',
12 }
9
});
14 main().catch(console.error);
11
console.log(result.text);
8
reasoning:'high',
Image input
11
{ type:'text', text:'Describe this image.'},
1
import{ generateText }from'ai';
8{
4
asyncfunctionmain(){
16
});
5
const result =awaitgenerateText({
6
model:'spacexai/grok-4.7',
14
},
2
import'dotenv/config';
9
role:'user',
7
messages:[
18
console.log(result.text);
15
],
12
{ type:'image', image:'https://example.com/photo.jpg'},
19 }
21 main().catch(console.error);
10
content:[
13
],
Tool calling
- 3
import'dotenv/config';
- 1
import{ generateText, tool }from'ai';
- 6
const result =awaitgenerateText({
- 21 main().catch(console.error);
- 10
getWeather:tool({
More models by SpaceXAI

Text
+1 more

Code
+1 more

—
+1 more

+1 more

All
+1 more

1M
+1 more

—
+1 more

+1 more
