Build with OpenMock.
An OpenAI-compatible simulated AI API. Sign in with Google, copy your API key, and start building without provisioning a real model or paying for inference.
Quickstart
1. Sign in with Google. Your account is created automatically and receives the configured starting credit balance.
2. Copy your API key. Your full openmock_live_... key is shown once. If you lose it, revoke it and generate a new one.
3. Set your API key.
export openmock_live_API_KEY="openmock_live_xxxxx"4. Make your first request.
curl https://openmock.vercel.app/api/v1/chat/completions \
-H "Authorization: Bearer $openmock_live_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mock-fast",
"messages": [{"role":"user","content":"Hello!"}]
}'Authentication
All /v1 endpoints that perform model operations require a Bearer API key. The model discovery endpoint is public.
Authorization: Bearer openmock_live_xxxxxxxxxxxxxxxxxModels
These are simulated models. They do not call OpenAI, Anthropic, Gemini, or another real LLM provider.
| Model | Latency | Credits | Max output |
|---|---|---|---|
| mock-fast | ~50–150ms | 1× | 1,000 |
| mock-smart | ~400–900ms | 2× | 2,000 |
| mock-reasoner | ~1–2.5s | 5× | 4,000 |
| mock-unstable | ~200ms–2s | 2× | Configurable |
To discover models programmatically:
curl https://openmock.vercel.app/api/v1/modelsChat completions
POST /api/v1/chat/completions
Supported request fields include model, messages, temperature, max_tokens, and stream.
{
"model": "mock-smart",
"messages": [
{"role": "system", "content": "You are helpful."},
{"role": "user", "content": "Give me a startup idea."}
],
"temperature": 0.7,
"max_tokens": 500,
"stream": false
}Responses use an OpenAI-compatible shape:
{
"id": "chatcmpl_mock_abc123",
"object": "chat.completion",
"created": 1788500000,
"model": "mock-smart",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "A simulated response..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 42,
"completion_tokens": 85,
"total_tokens": 127
}
}Streaming
Set stream: true to receive Server-Sent Events compatible with OpenAI streaming clients.
{
"model": "mock-smart",
"messages": [{"role":"user","content":"Tell me a story"}],
"stream": true
}The stream ends with:
data: [DONE]Streaming does not bypass credit accounting.
Credits & token usage
The Sandbox uses an approximate token counter rather than a real model tokenizer. Simulated token counts are used consistently for usage and credits.
Example
300 simulated tokens × the mock-smart 2× multiplier = 600 credits.
Successful requests are charged. Authentication failures, validation failures, unknown models, and insufficient-credit requests are not charged. Simulated model failures are not charged by default.
Errors
Errors use a consistent OpenAI-style structure.
{
"error": {
"message": "Insufficient credits",
"type": "insufficient_credits",
"code": "insufficient_credits"
}
}| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_request_error | Invalid request |
| 401 | authentication_error | Missing, invalid, or revoked key |
| 402 | insufficient_credits | Not enough credits |
| 404 | model_not_found | Unknown model |
| 429 | rate_limit_error | Rate limit exceeded |
| 500 | server_error | Server/simulated failure |
| 503 | service_unavailable | API temporarily disabled |
Every API response also includes an x-request-id header for debugging.
SDK examples
JavaScript / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.openmock_live_API_KEY,
baseURL: "https://openmock.vercel.app/api/v1",
});
const response = await client.chat.completions.create({
model: "mock-smart",
messages: [
{ role: "user", content: "Give me a hackathon project idea." }
],
});
console.log(response.choices[0].message.content);Python
from openai import OpenAI
client = OpenAI(
api_key="openmock_live_xxxxxxxxx",
base_url="https://openmock.vercel.app/api/v1",
)
response = client.chat.completions.create(
model="mock-smart",
messages=[
{"role": "user", "content": "Give me a hackathon project idea."}
],
)
print(response.choices[0].message.content)cURL
curl https://openmock.vercel.app/api/v1/chat/completions \
-H "Authorization: Bearer openmock_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "mock-fast",
"messages": [{"role":"user","content":"Hello!"}]
}'