JSPM

@microfox/suno-api

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q28536F

Suno API SDK for Microfox

Package Exports

  • @microfox/suno-api
  • @microfox/suno-api/package.json

Readme

Suno API SDK

A lightweight, type-safe SDK for interacting with the Suno API.

Installation

npm install @microfox/suno-api

Usage

import { createClient, postApiGenerate } from '@microfox/suno-api';

// Create a new client instance
const client = createClient();

// Generate audio
async function generate() {
  try {
    const response = await postApiGenerate({
      client: client,
      body: {
        prompt: "A soaring orchestral piece for a movie trailer",
        make_instrumental: false,
        wait_audio: false
      }
    });
    console.log(response);
  } catch (error) {
    console.error(error);
  }
}

generate();

Error Handling

The SDK uses Zod for runtime type validation and will throw errors if:

  • The message payload doesn't match the expected schema
  • The API response doesn't match the expected schema
  • The API request fails