Clatter LabsHelp Center

How do I list models in JavaScript?

How-toUpdated

Use the SDK, or fetch the endpoint directly to see every field.

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.gateway.clatterlabs.xyz/v1",
  apiKey: process.env.CLATTER_API_KEY,
  defaultHeaders: { "X-Clatter-Account": process.env.CLATTER_ACCOUNT_ID },
});

for await (const m of client.models.list()) console.log(m.id);

// all fields, including families and retired:
const all = await (await fetch("https://api.gateway.clatterlabs.xyz/v1/models")).json();
console.log(all.families[0].context_window, all.retired);

GET /v1/models doesn't need a key, so the plain fetch works without headers.

Every JavaScript example uses the same client (base URL, key and the X-Clatter-Account header); see Set up the JavaScript SDK. Full parameter list: Create a chat completion.

Good to know#

  • If calls fail unexpectedly, check status.clatterlabs.com before debugging further.
  • Your key's account is responsible for your end users' text under the Abuse policy. What it means for apps
  • 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.