Free $25 Credit from X.AI
Earlier this year, Elon Musk’s X.AI company open-sourced the Grok large language model and provided $25 in free credit to use it. You can register for an account on the official website x.ai and apply for an API key. The examples to invoke the Grok are given as tutorials.
curl https://api.x.ai/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer xai-......" -d '{
"messages": [
{
"role": "system",
"content": "You are a test assistant."
},
{
"role": "user",
"content": "Testing. Just say hi and hello world and nothing else."
}
],
"model": "grok-beta",
"stream": false,
"temperature": 0
}'
Children, being underage, cannot sign up for accounts for large language models like ChatGPT or X.AI. They typically rely on the free Copilot integrated into Microsoft’s Bing search engine. Ryan mentioned today that ChatGPT no longer requires login to use, though this version is somewhat restricted.
Longer prompts cost more. The cost is usage/token based. For simplicity you can think of a token is a word.
ChatGPT Wrote a Python Interaction Program for X.AI’s Grok Model
Since the $25 credit is free, I decided to create a simple Python program for my child to interact with the Grok large language model and let them learn about real-world programming applications. I asked ChatGPT to write the program, and its generated code worked without issues.
import requests
import json
api_key = "x_ai ..."
# Define the API endpoint and headers
url = "https://api.x.ai/v1/chat/completions"
headers = {
"Content-Type": "application/json",
f"Authorization": "Bearer {api_key}",
}
# Define a system message for context
system_message = {"role": "system", "content": "You are a test assistant."}
print("Welcome to the Grok, an AI chatbot. Type 'bye' to exit.\n")
while True:
# Prompt the user for input
user_input = input("You: ").strip()
# Check if the user wants to exit
if user_input.lower() == "bye":
print("Goodbye!")
break
if user_input == "":
continue
# Define the payload
payload = {
"messages": [
system_message,
{"role": "user", "content": user_input}
],
"model": "grok-beta",
"stream": False,
"temperature": 0
}
try:
# Make the request
response = requests.post(url, headers=headers, json=payload)
# Check the response status
if response.status_code == 200:
data = response.json()
assistant_response = data["choices"][0]["message"]["content"]
print(f"Grok: {assistant_response}\n")
else:
print(f"Error: {response.status_code} - {response.text}")
except Exception as e:
print(f"An error occurred: {e}")
I made some small modifications, such as avoiding empty prompts and using the strip function to remove leading and trailing spaces. Since the child uses a Mac, they needed to install Homebrew in Terminal, install Python, and then install the requests package with pip3 install requests to use the program.
Large Language Model
- Two Simple Commands to Deploy and Run the DeepSeek R1-8b Large Language Model (LLM)
- ChatGPT writes a Python Script to Interact with Grok LLM from x.ai (Free $25 Credit)
ChatGPT Use Cases
- ChatGPT writes a Python Script to Interact with Grok LLM from x.ai (Free $25 Credit)
- ChatGPT Use Case for Software Engineer: Review Pull Requests (Code Reviews)
- How ChatGPT Solves a Math Puzzle?
- ChatGPT Designs a Health Check Tool in Node.Js to Run on Free VPS Instance
- ChatGPT-4 uses Math Wolfram Plugin to Solve a Math Brain Teaser Question
- ChatGPT Refactors/Rewrites the Code using Promise.All - Sending Requests in Parallel
- ChatGPT Use Case: A Good Personal AI Assistant to Help You Write Emails
- Programming Language Conversion Tool based on ChatGPT AI
- ChatGPT4: integrated with DALL.E: Generate a Merry Christmas theme girl in Red Dress
- Have you started using ChatGPT-4o?
- From Idea to GitHub Pages: Building Tools with AI and Vibe Coding
ChatGPT - AGI (Artificial General Intelligence)
- Blog Traffic Declines after ChatGPT is Widely Adopted
- What is going to be the next trend in technology in the next 10 years?
- Asking ChatGPT the Price of a Bitcoin (Does ChatGPT Predict or Estimate?)
- On Waiting List of ChatGPT 4 API
- The System Design of Steem Blockchain (ChatGPT DApps) Bots
- Integrating ChatGPT Prompt AI to STEEM blockchain
- ChatGPT Gives a Correct Leetcode Solution (Rust: Binary Search Algorithm) after Several Attempts
- ChatGPT Fails to Solve the Sudoku
- OpenAI Text Classifier Fails to Detect ChatGPT Text
- Quantum Computing in Simple Terms (ChatGPT vs Notion AI)
- How ChatGPT Impacts UGC (User Generate Content)?
- The Young Prompt Engineers
Grok 3 AI
ChatGPT Fails to
- ChatGPT Fails to Read the Text from Image
- ChatGPT AI is not able to solve this Math Problem: Rhombus inside Sqaure
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Leetcode DCC Winner T-shirt
Next Post: Scammers Are Exploiting Multi-Signature Wallets (Tron): Stay Alert!
