DoublewordDoubleword

Realtime API

The realtime API is perfect for development to quickly iterate on prompts, validate model behavior, and prototype your pipeline prior to submitting your first batch. However, the real cost savings come from using the Batch API for production workloads.

Quick Start

Using the Playground

The fastest way to test the real-time API is through our interactive playground. Simply select a model, enter your prompt, and get instant responses.

Simple Code Example

from openai import OpenAI

client = OpenAI(
    base_url="https://api.doubleword.ai/v1",
    api_key="{{apiKey}}"
)

response = client.chat.completions.create(
    model="{{selectedModel.id}}",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is batch inference?"}
    ]
)

print(response.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.doubleword.ai/v1',
  apiKey: '{{apiKey}}'
});

const response = await client.chat.completions.create({
  model: '{{selectedModel.id}}',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'What is batch inference?' }
  ]
});

console.log(response.choices[0].message.content);
curl https://api.doubleword.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {{apiKey}}" \
  -d '{
    "model": "{{selectedModel.id}}",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is batch inference?"}
    ]
  }'

Easy Migration with Autobatcher

Once you've tested your prompts with the realtime API, switching to batch mode is trivial using Autobatcher. Autobatcher automatically converts your existing realtime API calls into batch requests - no code changes required beyond configuration.

This means you can develop and test with realtime responses, then flip a switch to get batch pricing for production - cutting your inference costs in half.

Next Steps