🌐
xAI
docs.x.ai › docs › tutorial
The Hitchhiker's Guide to Grok | xAI
Certain grok models can accept both text AND images as an input. For example: ... import os from xai_sdk import Client from xai_sdk.chat import user, image client = Client( api_key=os.getenv("XAI_API_KEY"), timeout=3600, # Override default timeout with longer timeout for reasoning models ) chat = client.chat.create(model="grok-4") chat.append( user( "What's in this image?", image("https://science.nasa.gov/wp-content/uploads/2023/09/web-first-images-release.png") ) ) response = chat.sample() print(response.content)
🌐
Merge.dev
merge.dev › blog › grok-api-key
How to get your Grok API key (5 steps)
January 2, 2025 - Below the welcome message, you should see a small text block that reads, “Manage API keys.” Click on this.
🌐
xAI
docs.x.ai › docs › overview
xAI API
Grok is our flagship AI model designed to deliver truthful, insightful answers. ... Create an API Key and make your first request.
🌐
Grok API
grok-api.apidog.io › chat-15796842e0
Chat - Grok API
curl --location --request POST 'https://api.x.ai/v1/chat/completions' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "messages": [ { "role": "system", "content": "You are Grok, a chatbot inspired by the Hitchhikers Guide to the Galaxy."
🌐
xAI
x.ai › api
API | xAI
Our API is compatible with OpenAI and Anthropic’s SDKs. Migrating is as easy as generating an API key and changing a URL.Start building · Installing Grok...
🌐
DataCamp
datacamp.com › tutorial › grok-3-api
Grok 3 API: A Step-by-Step Guide With Examples | DataCamp
May 1, 2025 - To use the API, we need to buy credits. Using prepaid credits rather than automatic invoice billing is recommended in the beginning, as it is a good safeguard against unexpected costs. You can buy tokens and get an overview of your usage in the xAI console ...
🌐
Analytics Vidhya
analyticsvidhya.com › home › how to access grok 3 api?
How to Access the Grok 3 API? - Analytics Vidhya
1. Visit grok.com and log in with your account credentials. 2. Click on your profile avatar in the top-right corner, choose Settings, and then select Manage. You’ll be redirected to the xAI Accounts page.
Published   July 25, 2025
🌐
DataCamp
datacamp.com › tutorial › grok-4-api
Grok 4 API: A Step-by-Step Guide With Examples | DataCamp
July 15, 2025 - Although its context window size almost doubled in comparison to its predecessor, Grok 4 is priced exactly the same as the standard Grok 3 model. You’ll pay $3 for every million input tokens and $15 for every million output tokens. To access the API, you’ll need to purchase credits. Starting out, it’s wise to use prepaid credits instead of automatic billing—this helps you avoid surprise charges. You can buy tokens and track your usage in the xAI console, under Invoices > Credits.
Find elsewhere
🌐
Apideck
apideck.com › blog › how-to-get-your-grok-xai-api-key
How to Get Your Grok (XAI) API Key
September 10, 2025 - curl https://api.x.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY_HERE" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-1", "messages": [ { "role": "user", "content": "What is happening on X today?" } ], "stream": false, "temperature": 0.7 }'
🌐
xAI
x.ai › news › api
API Public Beta | xAI
For example, if you’re currently using the OpenAI Python SDK, you can start using Grok by simply changing the base_url to https://api.x.ai/v1 and using your xAI API key that you created on console.x.ai.
🌐
Apidog
apidog.com › blog › grok-3-api
How to Use the Grok-3 API
November 16, 2025 - After downloading, run the installer and follow the prompts to set it up on your system. Once installed, launch Apidog and create a new project dedicated to your Grok-3 API work. This project serves as your workspace for all API-related tasks. ... Next, you need an API key to authenticate your requests. Head to the xAI console at .
🌐
Grok AI
grokai.bot › home
Grok AI API - Grok AI
May 15, 2025 - The API supports a context window of up to 131,072 tokens, though earlier claims suggested Grok 3 could handle 1 million tokens, which is not yet reflected in the API. The API is accessible via the xAI Console, where developers can generate API keys and manage usage.
🌐
Firecrawl
firecrawl.dev › blog › grok-2-setup-and-web-crawler-example
Getting Started with Grok-2: Setup and Web Crawler Example
To use the Grok-2 API, your account must have funds. Access the Cloud Console: After logging in, you’ll be directed to the x.ai Cloud Console.
🌐
xAI
docs.x.ai › docs › guides › chat
Responses API
import os from xai_sdk import Client from xai_sdk.chat import user, system client = Client( api_key=os.getenv("XAI_API_KEY"), management_api_key=os.getenv("XAI_MANAGEMENT_API_KEY"), timeout=3600, ) chat = client.chat.create(model="grok-4", store_messages=False) chat.append(system("You are Grok, a chatbot inspired by the Hitchhiker's Guide to the Galaxy.")) chat.append(user("What is the meaning of life, the universe, and everything?")) response = chat.sample() print(response)
🌐
Groq
console.groq.com › docs › api-reference
API Reference - GroqDocs
import Groq from "groq-sdk"; const groq = new Groq({ apiKey: process.env.GROQ_API_KEY }); async function main() { const model = await groq.models.retrieve("llama-3.3-70b-versatile"); console.log(model); } main();
🌐
Groq
console.groq.com › docs › overview
Overview - GroqDocs
import OpenAI from "openai"; const ... "openai/gpt-oss-20b", input: "Explain the importance of fast language models", }); console.log(response.output_text);...
🌐
AI/ML API
docs.aimlapi.com › api-references › text-models-llm › xai › grok-4
grok-4 | AI/ML API Documentation
async function main() { const response = await fetch('https://api.aimlapi.com/v1/chat/completions', { method: 'POST', headers: { 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>', 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'x-ai/grok-4-07-09', messages:[ { role:'user', content: 'Hello' } ], }), }); const data = await response.json(); console.log(JSON.stringify(data, null, 2)); } main();
🌐
AI SDK
ai-sdk.dev › providers › ai-sdk-providers › xai
AI SDK Providers: xAI Grok
It defaults to the XAI_API_KEY environment variable. ... Custom headers to include in the requests. fetch (input: RequestInfo, init?: RequestInit) => Promise<Response> Custom fetch implementation. Defaults to the global fetch function. You can use it as a middleware to intercept requests, or to provide a custom fetch implementation for e.g. testing. You can create xAI models using a provider instance. The first argument is the model id, e.g. grok-3.
🌐
Stammer
docs.stammer.ai › stammer.ai-docs › chat-ai-agents › vault › xai-api-key-grok
xAI API Key (Grok) | Stammer.ai Docs
Click the Create API Key button. A dialog window will open to customize permissions (Access Control Lists or ACLs). ... For general Grok access (e.g., chat completions), choose chat:write.