Getting started

Quick Start

Make your first request through GROUNDROCK in under a minute. We'll install the SDK, create an API key, and stream a chat completion.

1. Install the SDK

bash
npm install @groundrock/sdk

2. Get an API key

Sign in, create a project, and generate a key from Dashboard → API Keys. Keys are scoped per project — never share one key across environments.

Set your key as an environment variable named GROUNDROCK_KEY. Never commit keys to source control.

3. Your first request

ts
import { Groundrock } from "@groundrock/sdk";

const ai = new Groundrock({ apiKey: process.env.GROUNDROCK_KEY });

const res = await ai.chat({
  model: "openai/gpt-5",
  messages: [{ role: "user", content: "Explain quantum entanglement in one line." }],
});

console.log(res.output_text);

4. Stream responses

ts
const stream = await ai.chat({
  model: "openai/gpt-5",
  messages: [{ role: "user", content: "Write a haiku about latency." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.delta ?? "");
}

5. Swap providers, keep the code

Change one string, get a different provider. Add a fallback array and GROUNDROCK will retry against alternates on failure — automatically.

ts
await ai.chat({
  model: "anthropic/claude-opus-4",
  fallback: ["openai/gpt-5", "google/gemini-3-pro"],
  messages: [{ role: "user", content: "Ship it." }],
});
You're production-ready. Head to API Reference for the full contract, or the Models page for every supported model.