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.
npx agentmods add skills/nirholas/three.ws/xai-grok-api-guidenpx skills add nirholas/three.ws --skill xai-grok-api-guidegit clone --depth 1 https://github.com/nirholas/three.wsWrote 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.
[](https://agentmods.dev/skills/nirholas/three.ws/xai-grok-api-guide)<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="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00063 | $0.01071 |
| Opus 5 | $0.00032 | $0.00535 |
| Sonnet 5 | $0.00013 | $0.00214 |
| Haiku 4.5 | $0.00006 | $0.00107 |
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 yesterday.
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 \ 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']
}
}
}
]
});
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.
- yesterday First seen · 152 lines · 63 tokens per session scan A 8822aa421173
xai-grok-api-guide is a skill published in the GitHub repository nirholas/three.ws (110 stars, last pushed today), licensed Apache-2.0. It adds 63 tokens to every session and 1,071 once invoked, about $0.0003 per session on Opus 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.
Other skills, from other repositories
Prompt craft for ComfyUI generation
Use when writing prompts for ComfyUI image or video models: choosing tags vs literary format, fixing composition and anatomy artifacts, picking samplers per LoRA, and writing short movement prompts for video. Neutral examples only.
seedance-vocab-en
This skill should be used when an English Seedance 2.0 prompt is slop-heavy, generic, padded with empty quality words, tripping false-positive filters, or needs precise English production vocabulary for camera, lighting, motion, VFX, audio, and constraints.
llm-router
Selects the optimal LLM model and provider for each task based on complexity, cost budget, and capability requirements. Routes cheap tasks to Haiku/GPT-4o-mini and complex tasks to Sonnet/Opus/o1. Use when deciding which model to call, optimizing LLM costs, or building multi-model agent systems. Activate on "which…
qwen-image-prompting
Prompt Alibaba's Qwen-Image line for the typography work it is built for — quoting exact copy so the model stops inventing it, switching prompt expansion off before it rewrites your strings, describing layout in relative position and weight rather than point sizes, writing non-Latin scripts as characters, and…
system2-attention
System 2 attention mechanisms for deliberate, slow reasoning in transformer architectures.
security-copilot
Guidance for Microsoft Security Copilot - the generative-AI security platform that helps analysts investigate, hunt, summarise, and respond using natural language, plugins, promptbooks, and embedded experiences. Covers SCU provisioning, plugins, promptbooks, governance, and the standalone vs embedded experience…