Quick Start
Gridlock exposes an OpenAI-compatible REST API. Drop in your existing OpenAI SDK and add the gridlock options object to control SLA tier and privacy.
1. Install
bash
npm install openai
2. Send your first request
typescript
import OpenAI from 'openai'
const gridlock = new OpenAI({
baseURL: 'https://api.grid-lock.tech/v1',
apiKey: 'your-gridlock-api-key',
})
const res = await gridlock.chat.completions.create({
model: 'llama-3.1-8b-instant',
messages: [{ role: 'user', content: 'Hello!' }],
// Gridlock extension — passed transparently through OpenAI SDK
// @ts-expect-error gridlock extension
gridlock: {
sla: 'realtime', // 'realtime' | 'standard' | 'batch' | 'confidential'
privacy: false, // true = TEE-only workers
},
})
// Standard OpenAI response
console.log(res.choices[0].message.content)
// Gridlock SLA metadata (in res.gridlock)
const meta = (res as any).gridlock
console.log(`TTFT: ${meta.ttft_ms}ms, SLA ${meta.sla_met ? 'MET' : 'MISSED'}`)
if (!meta.sla_met) {
console.log(`Penalty: ${meta.penalty_due_lock} LOCK credited to your wallet`)
}3. Get an API key
API keys are available in the Console → API Keys tab. Each key can be scoped to a specific SLA tier and optionally restricted by IP. Rate limits scale with your staked LOCK balance.
4. SLA tiers at a glance
| Field | Type | Description |
|---|---|---|
| realtime | < 300ms TTFT | Streaming interactive apps. 2× penalty on miss. |
| standard | < 800ms TTFT | Most API use cases. 1× penalty on miss. |
| batch | < 5s TTFT | Offline processing. 0.25× penalty on miss. |
| confidential | < 800ms + TEE | Private inference inside NVIDIA CC / AMD SEV. 1× + slash. |
realtime
< 300ms TTFT
Streaming interactive apps. 2× penalty on miss.
standard
< 800ms TTFT
Most API use cases. 1× penalty on miss.
batch
< 5s TTFT
Offline processing. 0.25× penalty on miss.
confidential
< 800ms + TEE
Private inference inside NVIDIA CC / AMD SEV. 1× + slash.