grok-api

Provide OpenAI-compatible chat, tool calls, and streaming via api.x.ai.

1|4|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/The-Interdependency/a0 --skill grok-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: grok-api
Source: https://github.com/The-Interdependency/a0/tree/main/.agents/skills/grok-api
Command: npx skills add https://github.com/The-Interdependency/a0 --skill grok-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

OpenAI-compatible access to xAI Grok models (grok-4, grok-4-fast, grok-code-fast-1, grok-2-vision) via a stable Chat Completions endpoint, simplifying model selection, integration, and tool‑calling in downstream agents.

Core Features & Use Cases

  • Model selection and switching among Grok variants for reasoning, speed, coding, and vision tasks.
  • OpenAI‑compatible chat endpoint with streaming, tool calling, and structured outputs.
  • Live Search integration and cost/context guidance for production deployments.
  • a0p‑specific integration notes and wiring for Python providers and energy routing.

Quick Start

Start a Grok chat by sending a user message to the OpenAI-compatible endpoint with a selected model like grok-4-fast-reasoning.

Frequently Asked Questions about grok-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I access Grok models through an OpenAI-compatible API endpoint?

You can access Grok models through an OpenAI-compatible Chat Completions endpoint at api.x.ai, enabling reliable chat, tool calls, and streaming. This integration simplifies model selection and deployment in downstream agents.

Which Grok model variants are available for reasoning, coding, and vision tasks?

Available Grok model variants include grok-4, grok-4-fast-reasoning, grok-code-fast-1, and grok-2-vision. You can switch among these models to handle specific tasks like coding, vision, or fast reasoning.

Can I use tool calling and streaming with xAI Grok models?

Yes, the xAI Grok API supports OpenAI-compatible tool calling, structured outputs, and streaming. It also includes Live Search integration and cost controls for production deployments.

How do I integrate the Grok API using the xai_provider.py pattern?

Integration follows the xai_provider.py pattern, utilizing TOOL_SCHEMAS_CHAT for tool calls. It requires proper handling of usage data, rate limits, and tier gating to ensure reliable Grok model access.

Does the Grok API support Live Search and cost control features?

Yes, Grok API integration supports Live Search and provides cost and context guidance. These features help manage production deployments and control operational expenses when using Grok models.