TypeScript SDK
Typed from the OpenAPI document. Retries safely: every POST carries an
Idempotency-Key.
import { Marqloop } from "@marqloop/sdk";
const ml = new Marqloop({ apiKey, projectId });
const { data: post } = await ml.createPost({
text: "We launch on Monday.",
});
// Paid work: quote first, then spend exactly that.
const q = await ml.estimateCost({
operation: "generate_image",
input: { prompt: "A red bike" },
});
await ml.generateImage({
prompt: "A red bike",
expected_credits: q.data.credits,
});
MCP server
Streamable HTTP. Make an MCP token for one project in the app, then add the server to
your client.
{
"mcpServers": {
"marqloop": {
"url": "https://api-production-27221.up.railway.app/mcp",
"headers": {
"Authorization": "Bearer <MCP token>"
}
}
}
}
Tools that spend credits need the credits:spend scope and return
credits_charged.
REST and CLI
Base path /v1/public. Send the key as a Bearer token. Errors have one
shape.
curl -X POST https://api-production-27221.up.railway.app/v1/public/projects/$PROJECT/posts \
-H "Authorization: Bearer $MARQLOOP_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"text": "We launch on Monday."}'
# The CLI shows the price, then asks.
marqloop generate image --prompt "A red bike"