Let's build
something good.

From your first API key to your first response. The essentials, all in one place.

Quickstart

  1. Create an account and add credits in Billing.
  2. Generate a key from API keys. Copy it once and store it safely.
  3. Install the OpenAI SDK and make your first request.
bash
npm install openai
TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.VIKI_API_KEY,
  baseURL: "https://vikiapi.com/v1",
});

const response = await client.chat.completions.create({
  model: "openai/gpt-6.1-sol",
  messages: [{ role: "user", content: "Hello, Viki!" }],
  max_tokens: 512,
});

console.log(response.choices[0].message.content);

Authentication

Send your key in the Authorization header with every API request. Keep keys on your server. Never include them in client-side code or public repositories.

HTTP
Authorization: Bearer YOUR_VIKI_API_KEY

You can create and revoke keys from your dashboard. A key is only displayed in full when you create it.

Text generation

POST/v1/chat/completions

Use an OpenAI-compatible request body. Choose a text model ID from the library, provide a messages array, and optionally set max_tokens and temperature. The initial API returns complete responses; streaming is not enabled.

bash
curl https://vikiapi.com/v1/chat/completions \
  -H "Authorization: Bearer $VIKI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-6.1-sol",
    "messages": [{"role": "user", "content": "Write a haiku about possibility."}],
    "max_tokens": 128
  }'

Image generation

POST/v1/images/generations

Submit a model and prompt to create an image. Available resolution and aspect-ratio options depend on the model. The response includes the generated output.

bash
curl https://vikiapi.com/v1/images/generations \
  -H "Authorization: Bearer $VIKI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/flux-3-image",
    "prompt": "A quiet architectural photograph of a sunlit courtyard"
  }'

Video generation

POST/v1/videos

Video generation runs asynchronously. Submit a prompt, save the returned job ID, and poll its status. Video requests can take several minutes to finish.

bash
curl https://vikiapi.com/v1/videos \
  -H "Authorization: Bearer $VIKI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/veo-3.1",
    "prompt": "Soft morning light moving through a forest"
  }'

# Poll with the job ID from the response
curl https://vikiapi.com/v1/videos/YOUR_JOB_ID \
  -H "Authorization: Bearer $VIKI_API_KEY"

Continue polling until the job completes or fails. Use the returned output URL when it is ready.

Model library

GET/v1/models

Retrieve the available model IDs from the API, or browse the model library for descriptions and estimated provider rates. Different models support different generation settings.

Credits & billing

Viki uses a prepaid balance. Buy credits through Stripe in your dashboard. Model requests deduct actual provider usage plus the 20% platform fee. Estimated credits may be reserved while a request is running.

Video requests can keep a portion of your balance reserved while the job processes. Your dashboard separates available credits from pending reservations.

You can save a card securely with Stripe and opt into automatic top-ups in Billing. Choose the available-balance threshold, the amount to add, and a monthly limit. Automatic top-ups are off by default. Enabling them can trigger a charge if your available balance is already below the threshold. The monthly limit covers automatic top-ups initiated in each UTC calendar month, including payments still processing. Turn them off or remove your card at any time; a payment already processing may still complete.

If your bank declines a top-up or requires authentication, automatic top-ups pause. Update your card or complete a manual credit purchase, then explicitly enable automatic top-ups again. Requests still require enough available credits while a payment is pending.

View pricing

When something goes wrong

StatusMeaningNext step
400Invalid requestCheck the model and required fields.
401Not authenticatedCheck your API key.
402Not enough creditsAdd credits or wait for pending requests.
429Rate limitedWait briefly, then retry.
502 / 503Provider unavailableTry again later or choose another model.

Responses include an error message describing the issue. Failed requests are recorded so you can see what happened in your usage history.