Skip to content

API & SDK

Phantasmo's API surface is exposed through a type-safe client and shared schemas. Use these building blocks to automate workflows or build custom interfaces.

What You Get

  • @phantasmo/api - Typed client for generation and gallery operations.
  • @phantasmo/shared - Shared schemas and TypeScript types.

Quick Example

ts
import { createPhantasmoClient } from '@phantasmo/api/client'

const api = createPhantasmoClient({
  baseUrl: 'https://phantasmo.ai',
  getToken: async () => {
    // Return your auth token
    return await getAuthToken()
  }
})

const result = await api.image.generate({
  prompt: 'A sculptural lamp in soft morning light',
  settings: {
    aspectRatio: '4:3',
    imageCount: 2
  }
})

console.log(result.images)

Common Uses

  • Batch image generation
  • Custom UIs built on top of Phantasmo data
  • Automation that stays in sync with user plans and usage

Phantasmo Docs