agentleFS
rakaarwakyrakaarwaky/agents-arwaky/skills/ai-gateway/xai-api/SKILL.md

xai-api

Skill0 starsChanged 26 days agoMITView on GitHub

Grok API and Grok Build CLI reference." # 39 chars — safe

  • Reads credentials

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use skill_view(name='xai-api', file_path='references/<file>') to load a chapter when needed:

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

xAI / Grok API & Grok Build CLI

Reference skill covering the xAI Grok API (https://api.x.ai/v1) and the Grok Build CLI (grok binary). Use it when working with Grok models, the Responses API, server-side tools, or when delegating coding to the grok headless CLI. Source: https://docs.x.ai — every page is also available as markdown by appending .md to the URL (e.g. https://docs.x.ai/developers/models.md).

When to Use

  • Choosing a Grok model or checking pricing for a specific model.
  • Calling the xAI REST API (Responses, Chat Completions, Images, Voice).
  • Using server-side tools: function calling, web search, X search, code execution, structured outputs.
  • Driving the grok CLI headlessly for coding tasks (delegation pattern).
  • Configuring OmniRoute / custom providers with xAI models.
  • Checking rate limits or prompt caching behaviour.

Quick Reference

WhatWhere
Models + pricingreferences/models-pricing.md
Responses APIreferences/responses-api.md
Function calling + toolsreferences/tools.md
Structured outputsreferences/structured-outputs.md
Rate limits + tiersreferences/rate-limits.md
Grok Build CLI (headless)references/grok-build-cli.md
Grok Build features (sessions, worktrees, permissions)references/grok-build-features.md

Key Facts (always in context)

  • Base URL: https://api.x.ai/v1. Auth: Authorization: Bearer $XAI_API_KEY.
  • Flagship model: grok-4.6 (500k context, $2.00/$6.00 per 1M in/out tokens <200k prompt).
  • Grok Build model: grok-build-0.1 (256k context, $1.00/$2.00 per 1M tokens <200k prompt).
  • The Grok CLI binary is grok (installed at ~/.local/bin/grok, config at ~/.grok/).
  • Headless coding: grok -p "<brief>" --output-format json --always-approve — the -p flag DOES exist (verified in docs); earlier local --help output was misleading.
  • OmniRoute proxies xAI models via base_url: http://localhost:7777/v1.

Load on demand

Use skill_view(name='xai-api', file_path='references/<file>') to load a chapter when needed:

  • references/models-pricing.md — full model table, pricing tiers, model aliases, context limits.
  • references/responses-api.md — POST /v1/responses request body fields, response shape, conversation continuation.
  • references/tools.md — function calling, web search, X search, code execution, collections search, remote MCP; tool pricing.
  • references/structured-outputs.md — JSON schema support, response_format, Pydantic/Zod usage, constraint limits.
  • references/rate-limits.md — tier thresholds, per-model RPS/TPM tables, 429 handling.
  • references/grok-build-cli.md — grok subcommands, headless flags, ACP, session management.
  • references/grok-build-features.md — sessions, worktrees, permissions, sandbox, subagents, hooks, MCP servers.

Pitfalls

  • logprobs / top_logprobs are silently ignored on grok-4.20+ models.
  • Long-context pricing: requests with ≥200k prompt tokens are billed at the higher rate for ALL tokens, not just the overflow.
  • allowed_domains and excluded_domains cannot be set together in one Web Search request.
  • max_output_tokens defaults to 128,000 — set it explicitly for long generations.
  • previous_response_id + instructions are mutually exclusive; the previous response's system prompt is used instead.
  • Batch API: not all models support it; check each model page.
  • grok sessions live in ~/.grok/sessions/; worktrees in ~/.grok/worktrees/ and persist after the session ends.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.