FTN FineTunedNews
AI

xAI Opens Grok API Access With Free Credits: What It Means and How To Start

Why the free-credit push matters and a 5-minute Node and Python quickstart.

xAI Opens Grok API Access With Free Credits: What It Means and How To Start

xAI Opens Grok API Access With Free Credits: What It Means and How To Start

xAI is courting builders with free Grok API credits and simplified onboarding, part of a strategy to turn curiosity into usage. In its API launch communications, xAI said everyone in the public beta would receive 25 dollars in free credits per month through the end of 2024. The company has continued to run promotions and trials since, including updated pricing and periodic credit offers. Sources: xAI’s API Public Beta post and developer updates on X.


Quickstart: use the Grok API in 5 minutes

1) Set your API key

# macOS or Linux
export XAI_API_KEY="YOUR_API_KEY"

# Windows PowerShell
$env:XAI_API_KEY="YOUR_API_KEY"

2) Node setup

npm i openai

Create grok.js :

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.XAI_API_KEY,
  baseURL: "https://api.x.ai/v1"
});

async function main() {
  const res = await client.chat.completions.create({
    model: "grok-4",
    messages: [{ role: "user", content: "Explain vector search in Postgres in one paragraph." }]
  });

  console.log(res.choices[0].message.content);
}

main().catch(console.error);

Run it:

node grok.js

3) Python setup

pip install openai

Create grok.py:

from openai import OpenAI
import os

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

resp = client.chat.completions.create(
    model="grok-4",
    messages=[{"role": "user", "content": "Give me 3 study tips for finals week."}]
)

print(resp.choices[0].message.content)

Run it:

python grok.py

Final Thoughts

xAI is lowering the drawbridge. By pairing free or promotional credits with a compatible API, it invites students, indie builders, and executives to evaluate Grok without a heavy lift.

Support FineTunedNews

At FineTunedNews we believe that everyone whetever his finacial state should have accurated and verified news. You can contribute to this free-right by helping us in the way you want. Click here to help us.

Help us
© 2025 FineTunedNews. All rights reserved.
xAI Opens Grok API Access With Free Credits: What It Means and How To Start · FineTunedNews