API · 55 min

A script you run

Open Grok
  • Own a local curl or Python/Node script that calls api.x.ai
  • Document run steps and key location
  • Keep a human signature line on the output

If you cannot run it next Tuesday without this course, you do not have an API practice. You have a souvenir.

Why this matters

Applied ends when the week’s job is done in grok.com. API ends when your process can ask Grok and a human still signs. That is the last builder rung. It is not more noble than Applied. It is a different object.

Credits will bill. A loop in a while true will hurt. You are the adult.

Teach

Minimum viable script:

  1. Reads XAI_API_KEY from the environment.
  2. Sends one input string (file path or stdin is extra credit).
  3. Prints output_text or the error.
  4. Does not log the key.

You may write it with Grok Build in a scratch repo from C0b. You may write it by hand. You may keep it as a .sh with curl. Language is not the exam.

Add a three-line README only you need: how to export the key, the command, who is allowed to send the output.

Human signature. The script does not email customers. You do.

Worked example

weekly-brief.sh curls the Responses API with a pasted inbox extract. The clerk reads the stdout, deletes one invented date, and sends. The README says “not a cron job until we have a spend cap.”

Your turn

Help me write a 6-line README for my API script.

I will tell you:
- language or curl
- how I set XAI_API_KEY
- the one job it does
- who signs before anything leaves the machine

Write the README. Include: “This script was described in this thread. The key is not here.”
Then I will paste the redacted script (or curl) under it.

Artifact to paste

README + redacted script + one successful or honest-failed run note.

Rubric

  • Pass: Runnable shape. Key from env. Human signer named. No key in paste.
  • Fail: Only a grok.com chat. Key present. “I’ll cron this to the whole customer list.”

Common failure

A notebook on someone else’s Colab with the key in cell 1. That is not a system you own.

What’s next

You are at the end of the optional builder stack. grok.com remains the daily desk. Build remains the folder agent. Applied remains the job. Come back when the script breaks or the docs change the model name.

Your turn

grok.com

Your turn

Copy-ready prompt
Help me write a 6-line README for my API script.

I will tell you:
- language or curl
- how I set XAI_API_KEY
- the one job it does
- who signs before anything leaves the machine

Write the README. Include: “This script was described in this thread. The key is not here.”
Then I will paste the redacted script (or curl) under it.
Artifact

README + redacted script + one successful or honest-failed run note.

Read the lesson if you want. Submitting an artifact and marking complete needs a seat.