xai-grok-api-guide

xai-grok-api-guide is a skill for Claude Code, Codex from nirholas/three.ws. It costs 63 tokens per session (1,071 once invoked), scanned A, original, Apache-2.0.

A guide to using the xAI Grok API, an online service for sending requests to Grok language models. It covers text generation, image understanding, function calling, long prompts, and searches of current posts on X, formerly Twitter.

In plain words
What is it for?
It helps build API requests, add tool or function calls, process images, handle long context, and retrieve current X data.
Why use it?
It gives developers a reference for connecting applications to Grok and choosing among its documented model options.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit It helps build API requests, add tool or function calls, process images, handle long context, and retrieve current X data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nirholas/three.ws/xai-grok-api-guide
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nirholas/three.ws --skill xai-grok-api-guide
Clone the repo
git clone --depth 1 https://github.com/nirholas/three.ws

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for xai-grok-api-guide

README.md
[![agentmods](https://agentmods.dev/badge/skills/nirholas/three.ws/xai-grok-api-guide/github.svg)](https://agentmods.dev/skills/nirholas/three.ws/xai-grok-api-guide)
Your own site
<a href="https://agentmods.dev/skills/nirholas/three.ws/xai-grok-api-guide"><img src="https://agentmods.dev/badge/skills/nirholas/three.ws/xai-grok-api-guide/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for xai-grok-api-guide

Your own site · 80×15
<a href="https://agentmods.dev/skills/nirholas/three.ws/xai-grok-api-guide"><img src="https://agentmods.dev/badge/skills/nirholas/three.ws/xai-grok-api-guide.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,071 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 3 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Data Exfiltration · line 38
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
  • medium Data Exfiltration · line 38
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
  • medium Data Exfiltration · line 55
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.01071
Opus 5.5 $0.00025 $0.00428
Sonnet 5.5 $0.00013 $0.00214
Haiku 4.5 $0.00006 $0.00107

Measured 2mo ago against content hash 8822aa421173, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

xai-grok-api-guide scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl https://api.x.ai/v1/chat/completions \
data/skills/general/xai-grok-api-guide/SKILL.md · 152 lines

How it starts

The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.

xAI Grok API Guide

Grok is xAI's frontier AI model with native X (Twitter) data access. This guide covers API usage, models, and integration patterns.

Why Grok?

Feature Grok Advantage
Real-time X data Access to live tweets, trending topics
No knowledge cutoff Trained on latest data continuously
Humor/personality More engaging conversational style
Function calling Full tool support
Vision Image understanding
Long context 128K+ context window

Models

Model Context Best For Price (1M tokens)
Grok-3 128K Complex reasoning, analysis $5 / $15
Grok-2 128K General tasks, faster $2 / $10
Grok-2-mini 128K Quick responses, budget $0.50 / $2

Quick Start

curl https://api.x.ai/v1/chat/completions \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-3",
    "messages": [
      {"role": "user", "content": "What is trending in crypto on X right now?"}
    ]
  }'

OpenAI-Compatible API

import OpenAI from 'openai';

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

const response = await xai.chat.completions.create({
  model: 'grok-3',
  messages: [
    { role: 'system', content: 'You are a crypto market analyst.' },
    { role: 'user', content: 'Analyze $SPA on X/Twitter.' }
  ]
});

Function Calling

const response = await xai.chat.completions.create({
  model: 'grok-3',
  messages: [{ role: 'user', content: 'What is the price of SPA?' }],
  tools: [
    {
      type: 'function',
      function: {
        name: 'getTokenPrice',
        description: 'Get the current price of a cryptocurrency token',
        parameters: {
          type: 'object',
          properties: {
            symbol: { type: 'string', description: 'Token symbol (e.g., SPA, ETH)' },
            chain: { type: 'string', description: 'Blockchain (e.g., arbitrum)' }
          },
          required: ['symbol']
        }
      }
    }
  ]
});

Read the full file on GitHub · 152 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 152 lines · 63 tokens per session scan A 8822aa421173

Subscribe to this mod's changes

xai-grok-api-guide is a skill published in the GitHub repository nirholas/three.ws (287 stars, last pushed yesterday), licensed Apache-2.0. It adds 63 tokens to every session and 1,071 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

xai-grok-api-guide compared with skills from other repositories

xai-grok-api-guide next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
xai-grok-api-guidenirholas/three.wsSkill287yesterdayApache-2.0A63Claude Code, Codex
coding-agents-prompt-authoringgriddynamics/rosettaSkill3825d agoApache-2.0A39Claude Code
opik-optimizecomet-ml/opik-mcpSkill2274d agoApache-2.0A143Claude Code
strategyEliasOulkadi/shokuninSkill1121mo agoMITA42Claude Code, Codex
orchardcore-ai-workflowsCrestApps/CrestApps.AgentSkillsSkill147d agoMITA190Claude Code
image-generationGalbaz1/video-research-mcpSkill239d agoMITA45Claude Code
granite-pay-per-callnirholas/ibm-x402-mcpSkill919d agoApache-2.0A49Claude Code