Clatter LabsHelp Center

Can I use the Model API from Deno or Bun?

FAQUpdated

Yes. Both runtimes support the OpenAI package and fetch.

// Deno: import OpenAI from "npm:openai";
// Bun:  bun add openai, then import OpenAI from "openai";
const client = new OpenAI({
  baseURL: "https://api.gateway.clatterlabs.xyz/v1",
  apiKey: globalThis.Deno?.env.get("CLATTER_API_KEY") ?? process.env.CLATTER_API_KEY,
  defaultHeaders: { "X-Clatter-Account": globalThis.Deno?.env.get("CLATTER_ACCOUNT_ID") ?? process.env.CLATTER_ACCOUNT_ID },
});

In Deno, run with --allow-net --allow-env.

Good to know#

  • Your key's account is responsible for your end users' text under the Abuse policy. What it means for apps
  • Model ids: supercosmos-flash, supercosmos-max, supercosmos-heavy (SuperCosmos 1.1). Which to call
  • Each key has its own limit: 10, 30 (default), 60 or 120 requests per minute. Rate limits

Still need help?#

We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.