API Documentation

Integrate our AI models into your applications. Use our REST API to access text-to-image, text-to-video, image-to-image, and language models.

Authentication

All API requests require authentication using your API key. Get your API key from your profile page.

⚠️ You need to generate an API key. Visit your profile page to generate one.

Authorization Header
Authorization: Bearer YOUR_API_KEY

Base URL

API Endpoint
https://alpha.rest.runtimo.com

Call a Model

To call any model on Runtimo, make a POST request to the model's endpoint. The endpoint format is:

Endpoint Format: POST /v1/models/{endpoint_id}/call

Replace {endpoint_id} with the actual model ID (e.g., runtimo/flux-2 or runtimo/flux-2/klein/9b/base/lora).

Text-to-Image Example

Generate an image from a text prompt using a text-to-image model:

cURL Request
curl -X POST "https://alpha.rest.runtimo.com/v1/models/runtimo/flux-2/call" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": {"prompt": "a beautiful sunset over the ocean, cinematic lighting"}}'

Response

200 OK
{
  "images": [
    {
      "url": "https://v3b.runtimo.media/files/...",
      "content_type": "image/png",
      "width": 1024,
      "height": 1024
    }
  ],
  "cost_coins": 50,
  "cost_usd": 0.5
}

Examples

Text-to-Image

Generate images from text prompts using models like Flux, Stable Diffusion, and more.

Example Request
curl -X POST "https://alpha.rest.runtimo.com/v1/models/runtimo/flux-2/call" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": {"prompt": "a futuristic city at night, neon lights, cyberpunk style"}}'

Image-to-Image

Transform or edit existing images using image-to-image models.

Example Request
curl -X POST "https://alpha.rest.runtimo.com/v1/models/runtimo/flux-2/call" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": {"prompt": "make it more vibrant and colorful", "image_url": "https://example.com/image.jpg"}}'

Language Models

Use language models for text generation, chat, and conversation.

Example Request
curl -X POST "https://alpha.rest.runtimo.com/v1/models/runtimo/llama-3.1-8b-instruct/call" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": {"message": "Explain quantum computing in simple terms"}}'

SDK Examples

JavaScript/TypeScript

Example
const response = await fetch('https://alpha.rest.runtimo.com/v1/models/runtimo/flux-2/call', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    input: {
      prompt: 'a beautiful sunset over the ocean',
    },
  }),
});

const data = await response.json();
console.log(data.images[0].url);

Python

Example
import requests

response = requests.post(
    'https://alpha.rest.runtimo.com/v1/models/runtimo/flux-2/call',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
    },
    json={
        'input': {
            'prompt': 'a beautiful sunset over the ocean',
        },
    },
)

data = response.json()
print(data['images'][0]['url'])

Need an API Key?

Generate your API key from your profile page to start using our API.

Go to Profile