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_urlmust include/v1for 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, andx-ratelimit-reset-tokenswhen token limits apply.