We use cookies to improve the site and measure our ads. Manage your cookie preferences.

Skip to main content
Avatar
xAI/grokPublic
Circuit
Code
Versions
API
RUNNING
The circuit is running and is healthy.
0Total Runs
0Avg Response Time
-Avg Tokens per Second
0Avg Spend per Run
-Input Cache Hit Rate
0.00%Error Rate
Control Panel
Login to ModelWorksLogin to ModelWorks to use this circuit. To get started, get an API key.
Explore endpointsModelWorks allows apps to access LLMs and MCP servers worldwide easily in any datacenter, securely and privately.
SecretsOverride default secrets and set up your own for better billing and security.
Circuit Card

Grok X Logo

xAI GROK Chat Completion Service

Overview

The xAI GROK Chat Completion Service generates AI-driven chat completions using the GROK API. Grok is xAI's flagship AI model with industry-leading capabilities in reasoning, tool calling, and instruction following.


Available Models

ModelDescriptionContextPricing (per 1M tokens)
grok-4.3Latest flagship model with reasoning capabilities1M tokensInput: $1.25 / Output: $2.50
grok-4-1-fast-reasoningFast reasoning model with document support1M tokensInput: $0.20 / Output: $0.50

Grok 4.3

Key Features

  • Reasoning: Configurable reasoning effort (none/low/medium/high) with separate reasoning output
  • Function Calling: Full support for tools and parallel tool calls
  • Built-in Tools: Real-time web search and X search
  • Image Understanding: Process images via attachments
  • 1M Context Window: Handle large conversations and documents

Parameters

Required

ParameterTypeDescription
messagesarrayConversation messages

Optional

ParameterTypeDescription
reasoning_effortstringReasoning depth: none, low, medium, high
max_output_tokensnumberMaximum tokens to generate (includes reasoning tokens)
temperaturenumberSampling temperature (0-2)
top_pnumberNucleus sampling value
toolsarrayTool definitions (built-in: web_search, x_search, code_interpreter)
tool_choicestringTool usage: auto, none, or function name
parallel_tool_callsbooleanAllow parallel tool calls
attachmentblobImage attachment (blob ID or URL)
userstringEnd-user identifier for abuse monitoring

Outputs

OutputDescription
chat_completion_outputThe generated response text
chat_reasoning_outputThe reasoning trace (when reasoning enabled)
chat_completion_tool_callsTool calls made by the model
chat_completion_finish_reasonCompletion reason: stop, tool_calls, etc.

Example Requests

Basic Chat

{
  "input": {
    "messages": [
      { "role": "user", "content": "What is 2+2?" }
    ],
    "reasoning_effort": "low",
    "max_output_tokens": 500
  }
}

With Web Search

{
  "input": {
    "messages": [
      { "role": "user", "content": "What are the latest AI news today?" }
    ],
    "tools": [
      {"type": "web_search"},
      {"type": "x_search"}
    ]
  }
}

With Custom Function

{
  "input": {
    "messages": [
      { "role": "user", "content": "Get the weather for San Francisco" }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get weather for a location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": { "type": "string" }
            },
            "required": ["location"]
          }
        }
      }
    ],
    "tool_choice": "auto"
  }
}

Built-in Tools

ToolDescription
web_searchSearch the web for real-time information
x_searchSearch X (Twitter) posts, users, threads
code_interpreterExecute Python code in sandbox

The model automatically decides when to use these tools and returns citations in the response.


Cost

Token-based pricing (Grok 4.3): $1.25 per 1M input tokens, $2.50 per 1M output tokens.


Setup

  1. Configure your grok_api_key in your environment secrets
  2. Use the model via the chat completion endpoint

Notes

  • Use reasoning_effort to control thinking depth - higher values use more tokens but provide better analysis
  • Enable web_search or x_search in the tools array for real-time data
  • Pass image blob IDs or URLs via the attachment parameter for image processing

Enjoy dynamic chat completions with xAI GROK!

About
The xAI GROK Chat Completion Service is designed to generate AI-driven chat completions using the GROK API.
About the Author
xAI is an artificial intelligence research company founded by Elon Musk in July 2023, created with the mission to "understand the true nature of the universe" through advanced AI development. The company's flagship product is Grok, a family of large language models designed to compete directly with OpenAI's GPT and Anthropic's Claude. Grok models are deeply integrated with X (formerly Twitter), giving them unique access to real-time social media data and allowing them to provide up-to-date information on
Additional Information
Pricing Structure

The cost model for running this circuit. Charges may be fixed per execution or based on token usage.

Token-based Pricing
UsageLocal
Input tokens0.0₃125 credits
Output tokens0.0₃25 credits
Token pricing display: Per TokenPer Token