Documentation Index
Fetch the complete documentation index at: https://rimp.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The TypeScript SDK wraps every endpoint with full types, smart defaults, and a waitFor helper that polls async jobs to completion.
Install
Initialize
import { RimpClient } from '@rimp/sdk';
const client = new RimpClient({
apiKey: process.env.RIMP_API_KEY!,
// baseUrl defaults to https://api.rimp.example
});
Generations
Image (synchronous)
const gen = await client.generations.createImage({
model: 'flux-pro',
prompt: 'a red rimp on chrome',
aspect_ratio: '1:1',
num_outputs: 1,
});
// gen.outputs[0].url has the signed R2 URL (TTL 1h by default)
Video (asynchronous + waitFor)
const job = await client.generations.createVideo({
model: 'veo-3-1-fast',
prompt: 'waves at golden hour',
duration_s: 4,
});
const final = await client.generations.waitFor(job.id, {
pollIntervalMs: 2_000,
timeoutMs: 30 * 60_000,
});
Cancel
await client.generations.cancel(jobId);
Comparisons
const cmp = await client.comparisons.create({
prompt: 'cinematic portrait at golden hour',
models: ['flux-pro', 'imagen-4'],
});
const result = await client.comparisons.waitFor(cmp.id);
Models
const { data: models } = await client.models.list();
// → [{ slug: 'flux-pro', modality: 'image', pricing: { ... }, ... }, ...]
Uploads (for image-to-image / image-to-video)
const upload = await client.uploads.createPresigned('image/png');
await fetch(upload.url, {
method: 'PUT',
body: fileBlob,
headers: { 'Content-Type': 'image/png' },
});
// Then reference upload.id when creating a generation:
await client.generations.createVideo({
model: 'runway-gen4-turbo',
prompt: '...',
image_url: upload.public_url,
});
Webhooks
const { secret } = await client.webhooks.create({
url: 'https://app.example/webhooks/rimp',
events: ['generation.completed'],
});
// Save `secret` — used to verify incoming events.
See Webhooks for signature verification snippets.
Error handling
import { RimpApiError } from '@rimp/sdk';
try {
await client.generations.createImage({ model: 'flux-pro', prompt: '...' });
} catch (err) {
if (err instanceof RimpApiError) {
console.error(err.status, err.code, err.message, err.requestId);
} else {
throw err;
}
}
Edge runtime
The SDK uses fetch natively and works on Vercel Edge, Cloudflare Workers, Deno, Bun.
// app/api/route.ts (Next.js edge)
export const runtime = 'edge';
export async function POST(req: Request) {
const client = new RimpClient({ apiKey: process.env.RIMP_API_KEY });
const gen = await client.generations.createImage({ ... });
return Response.json(gen);
}