Grok MCP
Call Grok's dialogue and video generation capabilities in the AI Agent through MCP.
Access xAI's Grok family of models through an OpenAI-compatible format. Use Grok 4.7 for reasoning, coding, and visual analysis, or choose Grok 4.5, Grok 4, or Grok 3 based on the task.
Grok 4.7 supports text and image inputs and tool calling, making it suitable for reasoning, analysis, and in-app conversations. For video generation, see the Grok Imagine Video API.
Grok 4.7 is suited for math, programming, and complex analysis. Use reasoning_effort to select minimal, low, medium, or high.
Use an image_url content block to add images to Grok 4.7 messages and analyze screenshots, charts, and visual materials.
Call /grok/chat/completions through the OpenAI SDK and reuse the Chat Completions request format.
Use the OpenAI SDK you already know and seamlessly switch to Grok models by changing base_url.
from openai import OpenAI
client = OpenAI(
base_url="https://api.acedata.cloud/grok",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="grok-4.7",
messages=[{"role": "user", "content": "用一句话解释量子计算"}],
reasoning_effort="medium",
max_tokens=1024,
)
print(response.choices[0].message.content)The following response excerpt from the existing API guide shows the fields used to read the result. The example model, task ID, and media content come from that historical example; refer to the actual response for this request.
{
"id": "foaicmpl-13936918-cb99-49e1-b94c-bde98b482ed4",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Yo! What's up? 😎 Ready to dive into whatever you're pondering about today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 20,
"total_tokens": 28
}
}
From signing up to your first Grok conversation, it only takes a few minutes.
Log in to the application list, open General Application, and click the copy button to the right of API KEY. Store the key on your server and use it to replace YOUR_API_KEY in the example.
Select grok-4.7 or another released model from the model list.
Send a request through the OpenAI-compatible /grok/chat/completions endpoint.
Covering a range of use cases from everyday conversations to professional research.
Grok 4.7 can be used for code generation, code review, and debugging.
Handle complex data analysis tasks and generate insight reports and visualization suggestions.
Build customer service systems with Grok 3 to respond quickly to customer inquiries.
Writing articles, translation, summarization, advertising copy, and other writing tasks.
Complex reasoning, literature analysis, mathematical proofs, and exploration of scientific questions.
From ultra-fast reasoning to flagship reasoning, choose the model that suits you best
A next-generation flagship reasoning model supporting long context, visual understanding, and tool calling.
Mature, high-performance models suited to general reasoning, programming, and content tasks.
Pay by Token usage, with no subscription fees or hidden charges.
Get bigger discounts with bulk packages
Billed based on actual Token usage, with separate pricing for input and output
Tailored solutions for high-usage teams
Common questions about using the Grok API
For complex analysis, code review, or image and text tasks, start with Grok 4.7's default medium. For everyday conversations, compare the response quality, latency, and usage of other models before deciding on a production configuration.
Ace Data Cloud provides a unified OpenAI-compatible interface, with no need to register an xAI account or configure a separate API key. Use the same API Key to access models from multiple providers, including Grok, Claude, GPT, and Gemini.
Yes. Set base_url to https://api.acedata.cloud/grok, then select an available model and its corresponding parameters.
Yes. Set stream: true to receive token-by-token SSE streaming output, suitable for real-time conversations and frontend display.
Ace Data Cloud offers a range of large language model APIs
Choose a Grok model and get started with text conversations, visual understanding, or tool calls.