MelonsRun

Quickstart

Make your first MelonsRun API call in under a minute

Authentication

Both API halves authenticate with a Bearer API key:

  • sk- keys are write-capable — use them for generation endpoints.
  • tk- keys are read-only — do not use them for POST LLM calls.

/v2/quote and /v2/models are public and work without a key.

First LLM call

curl https://api.melons.run/v1/chat/completions \
  -H "Authorization: Bearer $MELONS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Reply with exactly: ok"}]
  }'

First media task

tasks.run(...) submits a task and polls until a terminal state (completed / failed / canceled):

const task = await client.tasks.run({ model: "m", input: { prompt: "a cat" } });

Contract notes

  • baseURL / base_url must include /v1 for OpenAI-compatible routes.
  • Successful non-streaming responses include x-credits-charged.
  • Streaming chat responses are forwarded as text/event-stream; usage is settled from the upstream usage chunk.
  • Rate limit headers use x-ratelimit-limit-tokens, x-ratelimit-remaining-tokens, and x-ratelimit-reset-tokens when token limits apply.

On this page