Grok 4.7 API
x-ai/grok-4.7Grok 4.7 turns text instructions, code, and documents into implementations and analysis, with stronger self-verification and sustained reasoning across connected tasks. Clear requirements and test evidence help it track dependencies and refine proposed changes throughout a multi-turn review.
Grok 4.7
xAI · chat-completions
Quick start
Send a POST request to /v1/chat/completions with x-ai/grok-4.7. Choose JSON or SSE with stream, and receive generated content and usage.
- Endpoint
- POST /v1/chat/completions
- Model ID
- x-ai/grok-4.7
- Protocol
- Chat Completions
Request fields
| Field | Requirement | Description |
|---|---|---|
| model | Required | x-ai/grok-4.7 |
| messages | Required | A non-empty ordered array with role and string content; use system, user, or assistant roles. |
| temperature | Optional | Ranges from 0 to 2; defaults to 1. Controls output randomness. |
| max_tokens | Optional | A positive integer setting the response output limit; the playground offers 1–65,536 and defaults to 4,096. |
| max_completion_tokens | Optional | A positive integer setting the completion-token budget. Choose one output-budget field per request. |
| top_p | Optional | Ranges from 0 to 1; defaults to 1. Adjust top_p or temperature to guide output variation. |
| frequency_penalty | Optional | Ranges from -2 to 2; defaults to 0. Positive values reduce frequent repetition. |
| presence_penalty | Optional | Ranges from -2 to 2; defaults to 0. Positive values encourage new topics. |
| stop | Optional | A stop string or an array of up to four stop strings. |
| n | Optional | An integer of at least 1; defaults to 1. Sets the number of completions. |
| stream | Optional | Defaults to false for complete JSON; true returns an SSE event stream. |
Response and usage
Successful responses include generated content and usage. Billing settles from actual input, output, and cache tokens.
Streaming
Set stream: true to read SSE. Finalize usage accounting from the terminal usage event.
curl --request POST \
--url "https://api.vidgo.ai/v1/chat/completions" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "x-ai/grok-4.7",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Review this function, identify edge cases, and suggest a corrected implementation."
}
],
"max_tokens": 4096,
"temperature": 1,
"top_p": 1,
"stream": false
}'Keep API keys on the server. Never expose them in browser code or public repositories.
Continue with
Related Models
Grok 4.7 API frequently asked questions
What is the Grok 4.7 API?
Grok 4.7 is an xAI model for coding and professional knowledge work. It turns text instructions, source code, and documents into implementations and analysis, with stronger self-verification and sustained reasoning across connected tasks. A larger base model and extended reinforcement learning on difficult tasks strengthen its checking of proposed changes and management of relevant context. You can call it programmatically or try it from the playground above.
What changed from Grok 4.6 to Grok 4.7?
Grok 4.7 uses a new, larger base model and a longer reinforcement learning run focused on harder, longer tasks. Its improvements include checking its own work and managing context during coding and knowledge work. Compare the two on the same source files, acceptance criteria, and test evidence to assess the results for your project.
How can Grok 4.7 help with a repository refactor?
Supply the files being changed together with their callers, shared types, and target behavior. Grok 4.7 can reason across these dependencies, propose connected edits, and explain the effect on each interface. Feed the resulting test output into the next turn to refine the proposal.
How does Grok 4.7 help check a bug fix?
Provide the failing input, observed result, expected behavior, and relevant code. Ask Grok 4.7 to trace the failure, explain why its proposed change addresses it, and produce regression cases. Its stronger self-verification is useful for reviewing the assumptions behind the proposed fix.
How can Grok 4.7 analyze long technical documents?
Place the relevant specifications and report excerpts in the standard 256K-token context, with section names and a clear question. Grok 4.7 can connect requirements across these materials and organize the findings. Ask it to name the supplied passages supporting each conclusion so the review stays tied to your sources.
How can Grok 4.7 turn requirements into test cases?
Give Grok 4.7 the required behavior, valid input ranges, and examples of failures. Ask for normal cases, boundary cases, and a reason for each assertion. After running the tests in your environment, provide the actual results for a focused follow-up review.
How can Grok 4.7 improve a technical design proposal?
Provide the design, constraints, dependencies, and alternatives being considered. Grok 4.7 can compare the approaches, identify assumptions, and draft a structured recommendation. Ask it to separate evidence from assumptions and tie proposed changes to your acceptance criteria.
How can Grok 4.7 help revise professional documents?
Supply the draft, source material, intended audience, and required format. Grok 4.7 can organize the argument, clarify technical explanations, and develop a revised draft using the supplied evidence. Continue with specific review comments to refine terminology and the level of detail.





























