Quotaflow
llms.txtOpenAPIDashboard
Examples

Python examples

When to use this page

Use this page for Python services, scripts, notebooks, or agents.

Install

pip install openai

Create a response

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["QUOTAFLOW_API_KEY"],
    base_url="https://api.quotaflow.ai/openai/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    input="Return only: connected",
    stream=False,
)

print(response)

Chat completions compatibility

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["QUOTAFLOW_API_KEY"],
    base_url="https://api.quotaflow.ai/openai/v1",
)

completion = client.chat.completions.create(
    model="gpt-5.5",
    messages=[{"role": "user", "content": "Return only: ready"}],
)

print(completion.choices[0].message.content)

Kimi JSON mode chat

Use kimi-k2.7-code on /chat/completions when you need a Chat Completions-shaped coding model with strict JSON output. GLM chat supports messages, streaming, and tools, but strict JSON mode returns 400 invalid_request_error.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["QUOTAFLOW_API_KEY"],
    base_url="https://api.quotaflow.ai/openai/v1",
)

kimi_json = client.chat.completions.create(
    model="kimi-k2.7-code",
    messages=[{"role": "user", "content": "Return JSON with status connected."}],
    response_format={"type": "json_object"},
    stream=False,
)

print(kimi_json.choices[0].message.content)

Embeddings

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["QUOTAFLOW_API_KEY"],
    base_url="https://api.quotaflow.ai/openai/v1",
)

embedding = client.embeddings.create(
    model="text-embedding-3-small",
    input="Quotaflow embeddings are connected.",
)

print(len(embedding.data[0].embedding))

Anthropic-compatible Messages

Use requests when you want to keep the Anthropic Messages request shape.

import os
import requests

response = requests.post(
    "https://api.quotaflow.ai/v1/messages",
    headers={
        "x-api-key": os.environ["QUOTAFLOW_API_KEY"],
        "anthropic-version": "2023-06-01",
        "Content-Type": "application/json",
    },
    json={
        "model": "claude-sonnet-4-6",
        "max_tokens": 128,
        "messages": [{"role": "user", "content": "Return only: connected"}],
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())

Image generation

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["QUOTAFLOW_API_KEY"],
    base_url="https://api.quotaflow.ai/openai/v1",
)

image = client.images.generate(
    model="gpt-image-2",
    prompt="A clean teal API dashboard illustration.",
    size="1024x1024",
    response_format="b64_json",
)

print(image.data[0].b64_json[:24])

Set response_format to url for non-streaming image generation or edits when you want a temporary hosted URL instead of inline base64.

Image editing

import os
import requests

with open("./input.png", "rb") as input_file, open("./mask.png", "rb") as mask_file:
    response = requests.post(
        "https://api.quotaflow.ai/openai/v1/images/edits",
        headers={"Authorization": f"Bearer {os.environ['QUOTAFLOW_API_KEY']}"},
        data={
            "model": "gpt-image-2",
            "prompt": "Change only the masked area to a clean teal gradient",
            "size": "1024x1024",
            "response_format": "b64_json",
        },
        files={"image": input_file, "mask": mask_file},
    )

edit = response.json()
print(edit["data"][0]["b64_json"][:24])

Video generation

Use requests for task-based video generation when your SDK version does not expose a video helper yet.

import os
import requests

headers = {
    "Authorization": f"Bearer {os.environ['QUOTAFLOW_API_KEY']}",
    "Content-Type": "application/json",
}

create_response = requests.post(
    "https://api.quotaflow.ai/openai/v1/videos",
    headers=headers,
    json={
        "model": "veo-3.1-fast-generate-001",
        "prompt": "A cinematic drone shot over a coastal city at sunrise.",
        "durationSeconds": 4,
        "resolution": "1080p",
        "aspectRatio": "16:9",
    },
    timeout=60,
)
create_response.raise_for_status()
task = create_response.json()
print(task)

task_id = task.get("id") or task.get("task_id")
result_response = requests.get(
    f"https://api.quotaflow.ai/openai/v1/videos/{task_id}",
    headers={"Authorization": f"Bearer {os.environ['QUOTAFLOW_API_KEY']}"},
    timeout=60,
)
result_response.raise_for_status()
print(result_response.json())