API Reference

Build Amazing Things with Hey Grok API

Integrate conversational AI, code analysis, image understanding, and more into your applications. RESTful, well-documented, and developer-friendly.

Quick Start

example.ts
// Quick Start Example
import { HeyGrok } from '@heygrok/sdk';

const grok = new HeyGrok({
  apiKey: process.env.HEYGROK_API_KEY
});

// Simple chat completion
const response = await grok.chat({
  messages: [
    { role: 'user', content: 'Explain quantum computing in simple terms' }
  ],
  model: 'grok-2-latest'
});

console.log(response.content);
// "Imagine a regular computer as a person who can only 
//  check one path in a maze at a time..."

API Endpoints

POST/v1/chat/completionsGenerate AI responses for conversations
POST/v1/embeddingsCreate vector embeddings for text
POST/v1/images/analyzeAnalyze and describe images
POST/v1/code/executeExecute code in a sandboxed environment
GET/v1/modelsList available AI models
GET/v1/usageCheck your API usage and limits

Why Developers Love Our API

Blazing Fast

Average response time under 200ms. Built on edge infrastructure for minimal latency worldwide.

Enterprise Security

SOC 2 Type II certified, end-to-end encryption, and comprehensive audit logs.

Global CDN

Deployed across 200+ edge locations. Fast responses no matter where your users are.

Developer First

SDKs for JavaScript, Python, Go, Ruby, and more. Comprehensive docs and examples.

Ready to Start Building?

Get your API key in seconds. First 1000 requests are on us!