Home/Integrations/OpenAI SDKs
SDKs

Use Qai with OpenAI SDKs

Qai follows the OpenAI chat completions API, so the official OpenAI SDKs work as they are. Change the base URL to https://llm.quickcasa.ai/v1 and use a Qai API key.

Connect OpenAI SDKs to Qai

Install the SDK

Use the official package for your language. No Qai-specific SDK is needed.

Install
pip install openai
# or
npm install openai

Point it at Qai (Python)

Set base_url and pass your Qai key. Start on qai-hello-world, which is free, then change the model name for production.

Python
import os
from openai import OpenAI

client = OpenAI(base_url="https://llm.quickcasa.ai/v1", api_key=os.environ["QAI_API_KEY"])

response = client.chat.completions.create(
    model="qai-hello-world",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

for chunk in client.chat.completions.create(
    model="qai-pro",
    messages=[{"role": "user", "content": "Write a haiku about Mondays"}],
    stream=True,
):
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")

Point it at Qai (Node)

Same idea in TypeScript or JavaScript: set baseURL and the key.

Node
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://llm.quickcasa.ai/v1',
  apiKey: process.env.QAI_API_KEY,
});

const response = await client.chat.completions.create({
  model: 'qai-pro',
  messages: [{ role: 'user', content: 'Hello' }],
});
console.log(response.choices[0].message.content);

Or set it once in the environment

Both SDKs read OPENAI_BASE_URL and OPENAI_API_KEY, so existing code switches to Qai without edits.

Environment
export OPENAI_BASE_URL=https://llm.quickcasa.ai/v1
export OPENAI_API_KEY=YOUR_QAI_API_KEY

Tested against Qai on November 25, 2026 with openai 3.59 (Python) and openai 7.64 (Node): chat, streaming, tool calls, JSON mode and image generation.

Limits and gotchas

  • Use client.chat.completions, not client.responses: Qai does not serve the Responses API and answers it with a 404.
  • Images work through client.images.generate with qai-imagine-turbo or qai-imagine-quality. Send hostMedia: true (in Python, extra_body={"hostMedia": True}) for a permanent URL. Uncensored imagine tiers (qai-imagine-uncensored and friends) return b64_json only and do not store the file.
  • Streamed responses end with a chunk that carries token usage.
  • Reasoning tiers (qai-flash, qai-think) think before they answer and those tokens count toward max_tokens, so leave a few hundred tokens of headroom.

Questions, answered.

Do I need a Qai SDK?
No. The official OpenAI SDKs work with a changed base URL and a Qai API key.
Does the Responses API work?
No. Qai serves chat completions, so use client.chat.completions.create.