All insights

Model APIs

Grok API Dashboard: Find the Console and Make Your First API Request

Find the xAI API console, create an API key, and make a first request to the documented Grok 4.7 model using Python and the Responses API.

Illustration for Grok api dashboard

The official Grok API dashboard is the xAI developer console. Use it for API access and credentials—not the consumer Grok chat service. Sign in or create an account, open API Keys, and create a key. Then use the key to call the API at https://api.x.ai/v1. The current quickstart uses the production model ID grok-4.7 and the Responses API.

Set up API access

  1. Sign in or create an account at console.x.ai.
  2. Open API Keys and create a key. Set it as an environment variable, as shown below. Keep the key on your server; do not put it in browser-side code or a public repository.
  3. Load credits for API use, as directed by the official quickstart.

The consumer Grok app and Grok Build are separate from the API console. Use the console for API credentials, then call the API from your application.

Make a first Grok API request

This example follows the current xAI quickstart’s Python pattern with the OpenAI Python SDK. The quickstart says to install the package with pip install openai, but does not specify a minimum SDK version. Use an installed release that provides client.responses.create and response.output_text.

pip install openai
export XAI_API_KEY="your_api_key"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["XAI_API_KEY"],
    base_url="https://api.x.ai/v1",
)

response = client.responses.create(
    model="grok-4.7",
    input="Explain what an API is in one sentence.",
)

print(response.output_text)

The documented success signal is generated text in response.output_text. The Responses API reference documents POST /v1/responses; the quickstart provides the model ID and Python example. xAI recommends the Responses API; its documentation identifies Chat Completions as a legacy endpoint. See the text-generation guide for further integration details.

Check pricing and usage

Before using the API in production, check the current pricing page for the model and billing details that apply to your account. This guide does not state token rates or regional billing conditions. After making requests, the console’s Usage Explorer can help review API consumption.

Avoid outdated setup details: xAI’s November 4, 2024 announcement described a beta model and temporary free-credit terms. Those were historical announcements, not current model or promotional guidance; consult the current documentation instead.

Sources

xAI Console

Grok API Quickstart

Responses API Reference

Generate Text

Best Practices Guide

API Pricing

Usage Explorer

API Public Beta

Contact us