Sdks
SDK Overview
Official TypeScript and Python clients for the MelonsRun platform
| Language | Package | Client class |
|---|---|---|
| TypeScript/JavaScript | @melons/sdk | Melons |
| Python | melons-sdk | Client |
Both SDKs expose one client that covers both halves of the platform:
- OpenAI-compatible LLM —
/v1/chat/completions,/v1/completions,/v1/embeddings,/v1/responses,/v1/models. Drop-in for the OpenAI SDK by pointingbaseURL/base_urlathttps://api.melons.run/v1. - Unified async media tasks —
/v2/task/*, withtasks.run(...)that submits a task and polls until a terminal state. - Quote & catalog —
/v2/quoteand/v2/models.
Design
openapi.json is the single source of truth. Each SDK is built in two
layers:
- Generated typed layer — produced directly from
openapi.json; never edited by hand. - Hand-written ergonomic wrapper — a thin
Melons/Clientclass withchat.completions.create(with streaming),tasks.create/tasks.get/tasks.run,quote,models.list, and typed errors mapped from the platform'sErrorEnvelope.
30-second quickstart
import { Melons } from "@melons/sdk";
const client = new Melons({ apiKey: process.env.MELONS_API_KEY });
const task = await client.tasks.run({ model: "m", input: { prompt: "a cat" } });