> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rimp.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Make your first image and video generation in under 5 minutes.

This guide walks you from zero to a successful image generation, then a video generation.
Prerequisites: an account at [app.rimp.example](https://app.rimp.example) and an API key from **Settings → API keys**.

## 1. Set your API key

<CodeGroup>
  ```bash macOS / Linux theme={null}
  export RIMP_API_KEY="sk_live_..."
  ```

  ```powershell Windows theme={null}
  $env:RIMP_API_KEY = "sk_live_..."
  ```
</CodeGroup>

## 2. Generate an image (synchronous)

Image models with sub-30s latency are returned directly in the response.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.rimp.example/v1/images \
    -H "Authorization: Bearer $RIMP_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: $(uuidgen)" \
    -d '{
      "model": "flux-pro",
      "prompt": "a red rimp on brushed chrome, studio lighting"
    }'
  ```

  ```ts TypeScript theme={null}
  import { RimpClient } from '@rimp/sdk';

  const client = new RimpClient({ apiKey: process.env.RIMP_API_KEY! });

  const gen = await client.generations.createImage({
    model: 'flux-pro',
    prompt: 'a red rimp on brushed chrome, studio lighting',
  });

  console.log(gen.outputs[0].url);
  ```

  ```python Python theme={null}
  from rimp import Client

  client = Client(api_key=os.environ["RIMP_API_KEY"])

  gen = client.generations.create_image(
      model="flux-pro",
      prompt="a red rimp on brushed chrome, studio lighting",
  )

  print(gen["outputs"][0]["url"])
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "id": "gen_abc123",
  "object": "generation",
  "status": "succeeded",
  "modality": "image",
  "charged_credits": 40,
  "outputs": [
    {
      "id": "out_xyz",
      "url": "https://cdn.rimp.example/...",
      "mime": "image/png",
      "width": 1024,
      "height": 1024
    }
  ]
}
```

## 3. Generate a video (asynchronous)

Video generation returns `202 Accepted` immediately. Poll the generation or subscribe to a webhook.

<CodeGroup>
  ```ts TypeScript theme={null}
  const job = await client.generations.createVideo({
    model: 'veo-3-1-fast',
    prompt: 'slow motion ocean waves crashing on dark volcanic rocks',
    duration_s: 4,
  });

  // Wait helper polls every 2s, up to 30 minutes
  const final = await client.generations.waitFor(job.id);
  console.log(final.outputs[0].url);
  ```

  ```python Python theme={null}
  job = client.generations.create_video(
      model="veo-3-1-fast",
      prompt="slow motion ocean waves crashing on dark volcanic rocks",
      duration_s=4,
  )

  final = client.generations.wait_for(job["id"])
  print(final["outputs"][0]["url"])
  ```
</CodeGroup>

## 4. Compare multiple models in one call

This is Rimp's headline feature — same prompt, N models, atomic credit reservation.

```ts theme={null}
const cmp = await client.comparisons.create({
  prompt: 'cinematic portrait of a fisherman at golden hour, 35mm film',
  models: ['flux-pro', 'imagen-4', 'ideogram-v2'],
  params_shared: { aspect_ratio: '1:1' },
});

// Poll once, get all three results
const result = await client.comparisons.waitFor(cmp.id);
result.generations.forEach((g) => console.log(g.model, g.outputs[0].url));
```

If your wallet can't cover the sum of all three estimates, the API returns `402 Insufficient credits` **before** charging anything.

## Next steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Bearer tokens, scoping, rotation, and IP allowlist.
  </Card>

  <Card title="Multi-model deep dive" icon="layer-group" href="/concepts/multi-model">
    How routing, capabilities, and pricing work across providers.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/concepts/webhooks">
    Receive `generation.completed` events instead of polling.
  </Card>

  <Card title="Idempotency" icon="rotate" href="/concepts/idempotency">
    Safely retry without double-charging.
  </Card>
</CardGroup>
