Skip to Content

Grok 4.7

Input $1.20, Output $3.60, Per 1M tokens$1.20 / $3.60per 1M

Not enough data

SpaceXAI

$ 65.00 2

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

Codex

$ 125.00 Hermes

5

prompt:'Why is the sky blue?'

API

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

No uptime data available for this time period.

Uptime24 hours

1H

Status24 hours

Reliability of providers.Visit the docs for more info.

1W

1W

Direct request success rate on AI Gateway and per-provider.Visit the docs for more info.

1D

1D

1H

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

13 } 10

});

7

system:'You are a concise technical assistant.',

14
  • 4

    asyncfunctionmain(){

  • 2

    import'dotenv/config';

  • providerOptions
  • maxOutputTokens

Type

number string

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

No Required

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?',

3

1

import{ generateText }from'ai';

2

import'dotenv/config';

12

},

5

const result =awaitgenerateText({

6

model:'spacexai/grok-4.7',

4

asyncfunctionmain(){

11

},

8

providerOptions:{

9

gateway:{

14

16 }

17

13

});

15

console.log(result.text);

10

only:['xai'],

18 main().catch(console.error);

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

Learn more in the AI Gateway reasoning guide.
3
1

import{ generateText }from'ai';

10

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 }

13

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

9

tools:{

4 15

},

11

description:'Get the current weather for a location',

17
  • 7

    model:'spacexai/grok-4.7',

  • 2

    import{ z }from'zod';

  • 18

    console.log(result.text);

  • 5

    asyncfunctionmain(){

16

});

19 } 14

}),

13

execute:async({ location })=>({ location, temperatureC:18}),

20
  • 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