Quotaflow
llms.txtOpenAPIDashboard
Examples

Node.js examples

When to use this page

Use this page for server-side JavaScript or TypeScript integrations.

Install

npm install openai

Create a response

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.QUOTAFLOW_API_KEY,
  baseURL: "https://api.quotaflow.ai/openai/v1"
});

const response = await client.responses.create({
  model: "gpt-5.5",
  input: "Return only: connected",
  stream: false
});

console.log(response);

Chat completions compatibility

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.QUOTAFLOW_API_KEY,
  baseURL: "https://api.quotaflow.ai/openai/v1"
});

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

console.log(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 OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.QUOTAFLOW_API_KEY,
  baseURL: "https://api.quotaflow.ai/openai/v1"
});

const kimiJson = await 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
});

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

Embeddings

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.QUOTAFLOW_API_KEY,
  baseURL: "https://api.quotaflow.ai/openai/v1"
});

const embedding = await client.embeddings.create({
  model: "text-embedding-3-small",
  input: "Quotaflow embeddings are connected."
});

console.log(embedding.data[0]?.embedding.length);

Anthropic-compatible Messages

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

const messageResponse = await fetch("https://api.quotaflow.ai/v1/messages", {
  method: "POST",
  headers: {
    "x-api-key": process.env.QUOTAFLOW_API_KEY ?? "",
    "anthropic-version": "2023-06-01",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "claude-sonnet-4-6",
    max_tokens: 128,
    messages: [{ role: "user", content: "Return only: connected" }]
  })
});

console.log(await messageResponse.json());

Image generation

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.QUOTAFLOW_API_KEY,
  baseURL: "https://api.quotaflow.ai/openai/v1"
});

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

console.log(image.data?.[0]?.b64_json?.slice(0, 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

Use multipart form data for uploaded image edits when your SDK version does not expose an image edit helper.

import { readFile } from "node:fs/promises";

const form = new FormData();
form.append("model", "gpt-image-2");
form.append("prompt", "Change only the masked area to a clean teal gradient");
form.append("image", new Blob([await readFile("./input.png")], { type: "image/png" }), "input.png");
form.append("mask", new Blob([await readFile("./mask.png")], { type: "image/png" }), "mask.png");
form.append("size", "1024x1024");
form.append("response_format", "b64_json");

const editResponse = await fetch("https://api.quotaflow.ai/openai/v1/images/edits", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.QUOTAFLOW_API_KEY}` },
  body: form
});

const edit = await editResponse.json();
console.log(edit.data?.[0]?.b64_json?.slice(0, 24));

Video generation

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

const createResponse = await fetch("https://api.quotaflow.ai/openai/v1/videos", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.QUOTAFLOW_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    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"
  })
});
const task = await createResponse.json();
console.log(task);

const taskId = task.id ?? task.task_id;
const resultResponse = await fetch(`https://api.quotaflow.ai/openai/v1/videos/${taskId}`, {
  headers: { Authorization: `Bearer ${process.env.QUOTAFLOW_API_KEY}` }
});
console.log(await resultResponse.json());