.do
Service TypesAi

AI Creative Services

Build AI-powered creative services that generate designs, images, videos, music, brand assets, and visual content using the Services-as-Software framework.

AI creative services automate the production of visual and multimedia content, from logo design and brand identity to image generation, video production, and music composition. These services enable businesses to produce professional creative assets at scale without traditional creative teams.

Overview

Creative services leverage generative AI models to produce original visual and multimedia content based on text prompts, style specifications, and brand guidelines. They can create everything from simple graphics to complex video productions, all while maintaining brand consistency and professional quality.

Key Benefits

  • Speed: Generate creative assets in seconds instead of days or weeks
  • Cost-Effective: Dramatically lower cost per asset compared to traditional creative agencies
  • Scalability: Produce unlimited variations and iterations
  • Consistency: Maintain brand guidelines across all creative output
  • Experimentation: Easily test multiple creative directions
  • Customization: Generate personalized creative for different audiences

Service Architecture

Creative services typically follow this pattern:

  1. Brief Processing: Parse creative requirements and constraints
  2. Concept Generation: Create initial creative concepts
  3. Asset Creation: Generate actual creative assets (images, videos, etc.)
  4. Style Application: Apply brand guidelines and style specifications
  5. Iteration: Refine based on feedback or requirements
  6. Format Export: Deliver in multiple formats and sizes
  7. Rights Management: Handle licensing and usage rights

Logo and Brand Identity Service

Generate complete brand identity packages including logos, color palettes, and typography:

import $, { ai, db, on, send } from 'sdk.do'

const brandIdentityService = await $.Service.create({
  id: 'brand-identity-generator',
  name: 'AI Brand Identity Designer',
  description: 'Generate complete brand identity including logo, colors, typography, and guidelines',
  type: $.ServiceType.Creative,
  subtype: 'brand-identity',

  capabilities: ['logo-design', 'color-palette-generation', 'typography-selection', 'brand-guidelines', 'asset-variations', 'usage-examples'],

  pricing: {
    model: 'per-project',
    tiers: [
      {
        name: 'essentials',
        price: 299,
        includes: ['3 logo concepts', 'primary logo variations', 'color palette', 'typography guide'],
      },
      {
        name: 'professional',
        price: 799,
        includes: ['all essentials', '5 logo concepts', 'secondary brand marks', 'pattern library', 'brand guidelines document', 'social media templates'],
      },
      {
        name: 'enterprise',
        price: 1999,
        includes: [
          'all professional',
          'unlimited concepts',
          'sub-brand development',
          'complete asset library',
          'interactive style guide',
          'implementation support',
        ],
      },
    ],
    revisions: {
      included: 3,
      additional: 50.0,
    },
  },

  inputSchema: {
    businessName: { type: 'string', required: true },
    industry: { type: 'string', required: true },
    description: { type: 'string', required: true },
    values: { type: 'array', items: { type: 'string' } },
    targetAudience: { type: 'string', required: true },
    competitors: { type: 'array', items: { type: 'string' } },
    stylePreferences: {
      type: 'object',
      properties: {
        modern: { type: 'boolean' },
        minimalist: { type: 'boolean' },
        bold: { type: 'boolean' },
        playful: { type: 'boolean' },
        elegant: { type: 'boolean' },
        technical: { type: 'boolean' },
      },
    },
    colorPreferences: { type: 'array', items: { type: 'string' } },
    tier: { type: 'string', enum: ['essentials', 'professional', 'enterprise'] },
  },

  outputSchema: {
    logoConcepts: { type: 'array' },
    selectedLogo: { type: 'object' },
    colorPalette: { type: 'object' },
    typography: { type: 'object' },
    brandGuidelines: { type: 'object' },
    assetLibrary: { type: 'array' },
  },
})

on($.ServiceRequest.created, async (request) => {
  if (request.serviceId !== brandIdentityService.id) return

  try {
    await send($.ServiceRequest.update, {
      requestId: request.id,
      status: 'processing',
      progress: 0.1,
    })

    const { businessName, industry, description, values, targetAudience, competitors, stylePreferences, colorPreferences, tier } = request.inputs

    // 1. Research and competitive analysis
    const research = await ai.generate({
      model: 'gpt-5',
      prompt: `Analyze the competitive landscape for brand identity:

        Business: ${businessName}
        Industry: ${industry}
        Description: ${description}
        Target audience: ${targetAudience}
        Competitors: ${competitors.join(', ')}

        Research:
        1. Common visual themes in ${industry}
        2. Competitor brand positioning
        3. Visual gaps and opportunities
        4. Industry color psychology
        5. Target audience preferences

        Provide insights to inform unique brand identity.`,
      maxTokens: 1500,
    })

    await send($.ServiceRequest.update, {
      requestId: request.id,
      progress: 0.2,
    })

    // 2. Generate brand strategy
    const brandStrategy = await ai.generate({
      model: 'gpt-5',
      prompt: `Develop brand strategy:

        Business: ${businessName}
        Values: ${values.join(', ')}
        Research: ${research.text}

        Define:
        1. Brand personality (3-5 adjectives)
        2. Visual direction
        3. Mood and tone
        4. Differentiation strategy
        5. Key visual elements to emphasize`,
      schema: {
        personality: { type: 'array', items: { type: 'string' } },
        visualDirection: { type: 'string' },
        mood: { type: 'string' },
        differentiation: { type: 'string' },
        keyElements: { type: 'array' },
      },
    })

    await send($.ServiceRequest.update, {
      requestId: request.id,
      progress: 0.3,
    })

    // 3. Generate color palette
    const colorPalette = await ai.generate({
      model: 'gpt-5',
      prompt: `Create color palette for ${businessName}:

        Brand strategy: ${JSON.stringify(brandStrategy.data)}
        Color preferences: ${colorPreferences.join(', ')}
        Industry: ${industry}

        Generate:
        - Primary color (main brand color)
        - Secondary colors (2-3 supporting colors)
        - Accent colors (1-2 for highlights)
        - Neutral colors (grays, backgrounds)

        For each color provide:
        - Hex code
        - RGB values
        - Name
        - Usage guidelines
        - Psychological meaning
        - Accessibility notes

        Ensure WCAG AA compliance for text.`,
      schema: {
        primary: {
          type: 'object',
          properties: {
            hex: { type: 'string' },
            rgb: { type: 'object' },
            name: { type: 'string' },
            usage: { type: 'string' },
            meaning: { type: 'string' },
          },
        },
        secondary: { type: 'array' },
        accent: { type: 'array' },
        neutral: { type: 'array' },
        accessibility: { type: 'object' },
      },
    })

    await send($.ServiceRequest.update, {
      requestId: request.id,
      progress: 0.4,
    })

    // 4. Select typography
    const typography = await ai.generate({
      model: 'gpt-5',
      prompt: `Select typography system for ${businessName}:

        Brand strategy: ${JSON.stringify(brandStrategy.data)}
        Visual direction: ${brandStrategy.data.visualDirection}

        Select:
        - Primary typeface (for logo and headlines)
        - Secondary typeface (for body text)
        - Display typeface (optional, for special uses)

        For each typeface:
        - Font family name
        - Weights to use
        - Usage guidelines
        - Fallback fonts
        - Pairing rationale

        Consider legibility, web availability, and brand personality.`,
      schema: {
        primary: {
          type: 'object',
          properties: {
            family: { type: 'string' },
            weights: { type: 'array' },
            usage: { type: 'string' },
            fallbacks: { type: 'array' },
          },
        },
        secondary: { type: 'object' },
        display: { type: 'object' },
        scaleSystem: { type: 'object' },
      },
    })

    await send($.ServiceRequest.update, {
      requestId: request.id,
      progress: 0.5,
    })

    // 5. Generate logo concepts
    const conceptCount = tier === 'essentials' ? 3 : tier === 'professional' ? 5 : 8

    const logoConcepts = await Promise.all(
      Array.from({ length: conceptCount }).map(async (_, i) => {
        // Generate concept brief
        const concept = await ai.generate({
          model: 'gpt-5',
          prompt: `Create logo concept ${i + 1} for ${businessName}:

            Business: ${businessName}
            Industry: ${industry}
            Brand strategy: ${JSON.stringify(brandStrategy.data)}
            Color palette: ${JSON.stringify(colorPalette.data)}
            Typography: ${JSON.stringify(typography.data)}
            Style preferences: ${JSON.stringify(stylePreferences)}

            Design approach ${i + 1}:
            ${getDesignApproach(i, stylePreferences)}

            Provide:
            - Concept name
            - Design direction
            - Visual elements
            - Symbolism and meaning
            - Detailed image generation prompt
            - SVG path description`,
          schema: {
            conceptName: { type: 'string' },
            direction: { type: 'string' },
            elements: { type: 'array' },
            symbolism: { type: 'string' },
            imagePrompt: { type: 'string' },
            svgDescription: { type: 'string' },
          },
        })

        // Generate actual logo image
        const logoImage = await generateLogoImage({
          prompt: concept.data.imagePrompt,
          colors: colorPalette.data,
          style: brandStrategy.data.visualDirection,
        })

        return {
          conceptNumber: i + 1,
          ...concept.data,
          imageUrl: logoImage.url,
          variations: await generateLogoVariations(logoImage, colorPalette.data),
        }
      })
    )

    await send($.ServiceRequest.update, {
      requestId: request.id,
      progress: 0.7,
    })

    // 6. Generate brand guidelines
    const brandGuidelines = await ai.generate({
      model: 'gpt-5',
      prompt: `Create comprehensive brand guidelines:

        Business: ${businessName}
        Brand strategy: ${JSON.stringify(brandStrategy.data)}
        Logo concepts: ${JSON.stringify(logoConcepts)}
        Colors: ${JSON.stringify(colorPalette.data)}
        Typography: ${JSON.stringify(typography.data)}

        Include:
        1. Brand story and values
        2. Logo usage rules
        3. Color system
        4. Typography system
        5. Imagery style
        6. Voice and tone
        7. Do's and don'ts
        8. Application examples`,
      maxTokens: 3000,
    })

    await send($.ServiceRequest.update, {
      requestId: request.id,
      progress: 0.85,
    })

    // 7. Generate asset library (for professional and enterprise tiers)
    let assetLibrary: any[] = []
    if (tier !== 'essentials') {
      assetLibrary = await generateAssetLibrary({
        businessName,
        logos: logoConcepts,
        colors: colorPalette.data,
        typography: typography.data,
        tier,
      })
    }

    await send($.ServiceRequest.update, {
      requestId: request.id,
      progress: 0.95,
    })

    // 8. Create presentation deck
    const presentationDeck = await createBrandPresentation({
      businessName,
      strategy: brandStrategy.data,
      concepts: logoConcepts,
      colors: colorPalette.data,
      typography: typography.data,
      guidelines: brandGuidelines.text,
    })

    // Deliver complete brand identity
    await send($.ServiceResult.deliver, {
      requestId: request.id,
      outputs: {
        brandStrategy: brandStrategy.data,
        logoConcepts,
        colorPalette: colorPalette.data,
        typography: typography.data,
        brandGuidelines: brandGuidelines.text,
        assetLibrary,
        presentationDeck,
        fileFormats: {
          logos: ['svg', 'png', 'jpg', 'pdf'],
          colorPalette: ['ase', 'json', 'css'],
          guidelines: ['pdf', 'html'],
        },
      },
    })

    // Process payment
    const tierPricing = brandIdentityService.pricing.tiers.find((t) => t.name === tier)
    await send($.Payment.charge, {
      customerId: request.customerId,
      amount: tierPricing!.price,
      description: `Brand Identity Package: ${tier}`,
      metadata: {
        businessName,
        tier,
        conceptCount,
      },
    })
  } catch (error) {
    await send($.ServiceRequest.fail, {
      requestId: request.id,
      error: {
        code: 'DESIGN_GENERATION_FAILED',
        message: error.message,
      },
    })
  }
})

function getDesignApproach(index: number, stylePreferences: any): string {
  const approaches = [
    'Minimalist wordmark focusing on typography',
    'Abstract symbol representing core values',
    'Lettermark combining initials creatively',
    'Iconic symbol with clean lines',
    'Geometric shapes expressing stability',
    'Organic forms suggesting growth',
    'Modern gradient approach',
    'Negative space clever design',
  ]
  return approaches[index] || approaches[0]
}

async function generateLogoImage(params: any) {
  // Integration with image generation API (DALL-E, Midjourney, Stable Diffusion)
  return {
    url: 'generated-logo-url',
    width: 1024,
    height: 1024,
  }
}

async function generateLogoVariations(logo: any, colors: any) {
  return [
    { type: 'full-color', url: 'full-color-url' },
    { type: 'single-color', url: 'single-color-url' },
    { type: 'white', url: 'white-url' },
    { type: 'black', url: 'black-url' },
    { type: 'reversed', url: 'reversed-url' },
  ]
}

async function generateAssetLibrary(params: any) {
  const assets = []

  // Business cards
  assets.push({
    type: 'business-card',
    variations: ['front', 'back'],
    formats: ['pdf', 'png'],
  })

  // Social media templates
  if (params.tier === 'professional' || params.tier === 'enterprise') {
    assets.push({
      type: 'social-media',
      platforms: ['instagram', 'facebook', 'twitter', 'linkedin'],
      formats: ['psd', 'png'],
    })
  }

  // Presentation templates
  if (params.tier === 'enterprise') {
    assets.push({
      type: 'presentation',
      slides: 20,
      format: 'pptx',
    })
  }

  return assets
}

async function createBrandPresentation(data: any) {
  return {
    slides: [
      { type: 'cover', content: data.businessName },
      { type: 'strategy', content: data.strategy },
      { type: 'concepts', content: data.concepts },
      { type: 'colors', content: data.colors },
      { type: 'typography', content: data.typography },
      { type: 'applications', content: 'usage examples' },
    ],
    format: 'pdf',
  }
}

Image Generation Service

On-demand image generation for marketing and content:

import $, { ai, db, on, send } from 'sdk.do'

const imageGenerationService = await $.Service.create({
  id: 'image-generator',
  name: 'AI Image Generator',
  description: 'Generate custom images from text descriptions',
  type: $.ServiceType.Creative,
  subtype: 'image-generation',

  pricing: {
    model: 'per-image',
    tiers: [
      { resolution: '512x512', price: 2.0 },
      { resolution: '1024x1024', price: 5.0 },
      { resolution: '2048x2048', price: 10.0 },
    ],
    variations: {
      perVariation: 1.0,
    },
    styles: {
      standard: 1.0,
      premium: 1.5, // More detailed prompts, better models
      custom: 2.0, // Custom style training
    },
    bulk: [
      { images: { min: 10, max: 49 }, discount: 0.1 },
      { images: { min: 50, max: 99 }, discount: 0.2 },
      { images: { min: 100, max: Infinity }, discount: 0.3 },
    ],
  },
})

on($.ServiceRequest.created, async (request) => {
  if (request.serviceId !== imageGenerationService.id) return

  const { prompts, resolution, style, variations, negativePrompt, aspectRatio, seed } = request.inputs

  const results = []

  for (const prompt of prompts) {
    // Enhance the prompt
    const enhancedPrompt = await ai.generate({
      model: 'gpt-5',
      prompt: `Enhance this image generation prompt:

        Original: "${prompt}"
        Style: ${style}
        Desired quality: professional, detailed, ${style === 'premium' ? 'award-winning' : 'high-quality'}

        Add:
        - Technical details (lighting, composition, camera angle)
        - Style descriptors
        - Quality markers
        - Atmospheric elements

        Keep it under 200 words.`,
      maxTokens: 300,
    })

    // Generate base image
    const baseImage = await generateImage({
      prompt: enhancedPrompt.text,
      negativePrompt,
      resolution,
      aspectRatio,
      seed,
      style,
    })

    // Generate variations if requested
    const imageVariations = variations > 1 ? await generateImageVariations(baseImage, variations - 1) : []

    results.push({
      prompt: prompt,
      enhancedPrompt: enhancedPrompt.text,
      baseImage: {
        url: baseImage.url,
        width: baseImage.width,
        height: baseImage.height,
        seed: baseImage.seed,
      },
      variations: imageVariations,
      metadata: {
        model: baseImage.model,
        steps: baseImage.steps,
        cfgScale: baseImage.cfgScale,
      },
    })
  }

  await send($.ServiceResult.deliver, {
    requestId: request.id,
    outputs: {
      images: results,
      totalImages: results.length + results.reduce((sum, r) => sum + r.variations.length, 0),
    },
  })

  // Calculate cost
  const imageCount = prompts.length
  const totalVariations = imageCount * (variations || 1)
  const resolutionTier = imageGenerationService.pricing.tiers.find((t) => t.resolution === resolution)
  const styleMultiplier = imageGenerationService.pricing.styles[style] || 1.0
  const bulkTier = imageGenerationService.pricing.bulk.find((b) => totalVariations >= b.images.min && totalVariations <= b.images.max)
  const discount = bulkTier?.discount || 0

  const baseCost = resolutionTier!.price * imageCount * styleMultiplier
  const variationCost = (variations - 1) * imageCount * imageGenerationService.pricing.variations.perVariation
  const totalCost = (baseCost + variationCost) * (1 - discount)

  await send($.Payment.charge, {
    customerId: request.customerId,
    amount: totalCost,
    description: `Image Generation: ${totalVariations} images (${resolution})`,
    metadata: {
      imageCount,
      variations,
      resolution,
      style,
    },
  })
})

async function generateImage(params: any) {
  // Integration with Stable Diffusion, DALL-E, Midjourney API
  return {
    url: 'generated-image-url',
    width: parseInt(params.resolution.split('x')[0]),
    height: parseInt(params.resolution.split('x')[1]),
    seed: params.seed || Math.floor(Math.random() * 1000000),
    model: 'stable-diffusion-xl',
    steps: params.style === 'premium' ? 50 : 30,
    cfgScale: 7.5,
  }
}

async function generateImageVariations(baseImage: any, count: number) {
  return Array.from({ length: count }).map((_, i) => ({
    url: `variation-${i + 1}-url`,
    seed: baseImage.seed + i + 1,
  }))
}

Video Production Service

Automated video creation from scripts and assets:

import $, { ai, db, on, send } from 'sdk.do'

const videoProductionService = await $.Service.create({
  id: 'video-producer',
  name: 'AI Video Producer',
  description: 'Generate marketing videos, explainers, and social media content',
  type: $.ServiceType.Creative,
  subtype: 'video-production',

  pricing: {
    model: 'per-video',
    tiers: [
      {
        name: 'short-form',
        duration: { max: 60 },
        price: 150,
        features: ['script', 'voiceover', 'stock-footage', 'basic-editing'],
      },
      {
        name: 'standard',
        duration: { max: 180 },
        price: 400,
        features: ['all-short-form', 'custom-animations', 'music', 'subtitles'],
      },
      {
        name: 'professional',
        duration: { max: 600 },
        price: 1000,
        features: ['all-standard', 'advanced-effects', 'custom-graphics', 'color-grading'],
      },
    ],
    additions: {
      customVoiceover: 50,
      translations: 25,
      additionalRevisions: 75,
    },
  },
})

on($.ServiceRequest.created, async (request) => {
  if (request.serviceId !== videoProductionService.id) return

  const { topic, duration, style, targetPlatform, brandAssets, voicePreference, tier } = request.inputs

  // 1. Generate video script
  const script = await ai.generate({
    model: 'gpt-5',
    prompt: `Write a video script:

      Topic: ${topic}
      Duration: ${duration} seconds
      Style: ${style}
      Platform: ${targetPlatform}

      Structure:
      - Hook (first 3 seconds)
      - Introduction
      - Main points (2-3 key messages)
      - Call to action
      - Outro

      Include:
      - Dialogue/voiceover text
      - Scene descriptions
      - Visual cues
      - Timing markers

      Keep it engaging and platform-appropriate.`,
    schema: {
      scenes: {
        type: 'array',
        items: {
          type: 'object',
          properties: {
            sceneNumber: { type: 'number' },
            duration: { type: 'number' },
            voiceover: { type: 'string' },
            visualDescription: { type: 'string' },
            textOverlay: { type: 'string' },
            transition: { type: 'string' },
          },
        },
      },
      totalDuration: { type: 'number' },
      callToAction: { type: 'string' },
    },
  })

  // 2. Generate or select visuals for each scene
  const sceneAssets = await Promise.all(
    script.data.scenes.map(async (scene: any) => {
      // Generate scene image or select stock footage
      const visual = await ai.generate({
        model: 'gpt-5',
        prompt: `Create visual for this scene:

          Description: ${scene.visualDescription}
          Duration: ${scene.duration}s
          Style: ${style}

          Determine:
          - Best visual type (static image, animation, stock video)
          - Image generation prompt (if needed)
          - Stock video search query (if needed)
          - Animation type (if needed)`,
        schema: {
          type: { type: 'string' },
          imagePrompt: { type: 'string' },
          stockQuery: { type: 'string' },
          animationType: { type: 'string' },
        },
      })

      let asset
      if (visual.data.type === 'generated-image') {
        asset = await generateImage({
          prompt: visual.data.imagePrompt,
          resolution: '1920x1080',
          style: 'cinematic',
        })
      } else if (visual.data.type === 'stock-video') {
        asset = await searchStockVideo(visual.data.stockQuery)
      } else if (visual.data.type === 'animation') {
        asset = await generateAnimation(visual.data.animationType, scene.duration)
      }

      return {
        sceneNumber: scene.sceneNumber,
        asset,
        duration: scene.duration,
        textOverlay: scene.textOverlay,
      }
    })
  )

  // 3. Generate voiceover
  const voiceover = await generateVoiceover({
    script: script.data.scenes.map((s: any) => s.voiceover).join('\n\n'),
    voice: voicePreference,
    language: 'en-US',
  })

  // 4. Select background music
  const music = await selectBackgroundMusic({
    mood: style,
    duration: script.data.totalDuration,
    platform: targetPlatform,
  })

  // 5. Composite video
  const video = await composeVideo({
    scenes: sceneAssets,
    voiceover,
    music,
    brandAssets,
    style,
    platform: targetPlatform,
    duration: script.data.totalDuration,
  })

  // 6. Generate subtitles
  const subtitles = await generateSubtitles({
    script: script.data.scenes,
    timings: video.timings,
  })

  // 7. Apply platform-specific formatting
  const finalVideo = await formatForPlatform({
    video,
    subtitles,
    platform: targetPlatform,
    brandAssets,
  })

  await send($.ServiceResult.deliver, {
    requestId: request.id,
    outputs: {
      video: {
        url: finalVideo.url,
        duration: finalVideo.duration,
        resolution: finalVideo.resolution,
        format: finalVideo.format,
      },
      script: script.data,
      subtitles,
      assets: {
        voiceover: voiceover.url,
        music: music.url,
        scenes: sceneAssets,
      },
      variations: await generatePlatformVariations(finalVideo, ['instagram-square', 'instagram-story', 'youtube', 'tiktok']),
    },
  })

  const tierPricing = videoProductionService.pricing.tiers.find((t) => t.name === tier)
  await send($.Payment.charge, {
    customerId: request.customerId,
    amount: tierPricing!.price,
    description: `Video Production: ${tier} (${duration}s)`,
    metadata: {
      duration,
      tier,
      platform: targetPlatform,
    },
  })
})

async function generateVoiceover(params: any) {
  // Integration with ElevenLabs, Google Text-to-Speech, etc.
  return {
    url: 'voiceover-audio-url',
    duration: 45,
    format: 'mp3',
  }
}

async function selectBackgroundMusic(params: any) {
  // Integration with Epidemic Sound, AudioJungle, etc.
  return {
    url: 'background-music-url',
    title: 'Upbeat Corporate',
    duration: params.duration,
  }
}

async function searchStockVideo(query: string) {
  // Integration with Pexels, Unsplash, etc.
  return {
    url: 'stock-video-url',
    duration: 10,
  }
}

async function generateAnimation(type: string, duration: number) {
  // Generate simple animations
  return {
    url: 'animation-url',
    type,
    duration,
  }
}

async function composeVideo(params: any) {
  // Video composition using FFmpeg or cloud service
  return {
    url: 'composed-video-url',
    duration: params.duration,
    resolution: '1920x1080',
    format: 'mp4',
    timings: params.scenes.map((s: any) => ({
      scene: s.sceneNumber,
      start: 0,
      end: s.duration,
    })),
  }
}

async function generateSubtitles(params: any) {
  return {
    format: 'srt',
    content: 'subtitle file content',
    url: 'subtitles-url',
  }
}

async function formatForPlatform(params: any) {
  const specs = getPlatformSpecs(params.platform)
  return {
    url: 'formatted-video-url',
    duration: params.video.duration,
    resolution: specs.resolution,
    format: specs.format,
    aspectRatio: specs.aspectRatio,
  }
}

async function generatePlatformVariations(video: any, platforms: string[]) {
  return platforms.map((platform) => ({
    platform,
    url: `${platform}-video-url`,
    specs: getPlatformSpecs(platform),
  }))
}

function getPlatformSpecs(platform: string) {
  const specs: Record<string, any> = {
    'instagram-square': { resolution: '1080x1080', aspectRatio: '1:1', format: 'mp4' },
    'instagram-story': { resolution: '1080x1920', aspectRatio: '9:16', format: 'mp4' },
    youtube: { resolution: '1920x1080', aspectRatio: '16:9', format: 'mp4' },
    tiktok: { resolution: '1080x1920', aspectRatio: '9:16', format: 'mp4' },
    facebook: { resolution: '1280x720', aspectRatio: '16:9', format: 'mp4' },
    linkedin: { resolution: '1920x1080', aspectRatio: '16:9', format: 'mp4' },
  }
  return specs[platform] || specs['youtube']
}

Music Composition Service

Generate background music and audio branding:

import $, { ai, db, on, send } from 'sdk.do'

const musicCompositionService = await $.Service.create({
  id: 'music-composer',
  name: 'AI Music Composer',
  description: 'Generate original music for videos, podcasts, and brand audio',
  type: $.ServiceType.Creative,
  subtype: 'music-composition',

  pricing: {
    model: 'per-composition',
    tiers: [
      { duration: { max: 30 }, price: 50, features: ['single-instrument', 'basic-mixing'] },
      { duration: { max: 120 }, price: 150, features: ['multi-instrument', 'professional-mixing'] },
      { duration: { max: 300 }, price: 400, features: ['full-orchestra', 'mastering', 'stems'] },
    ],
    styles: {
      simple: 1.0,
      moderate: 1.5,
      complex: 2.0,
    },
    licensing: {
      standard: 0, // Included
      extended: 200, // Commercial use
      exclusive: 1000, // Exclusive rights
    },
  },
})

on($.ServiceRequest.created, async (request) => {
  if (request.serviceId !== musicCompositionService.id) return

  const { mood, genre, duration, instruments, tempo, useCase, referenceTrack } = request.inputs

  // 1. Analyze requirements and references
  const musicBrief = await ai.generate({
    model: 'gpt-5',
    prompt: `Create music composition brief:

      Mood: ${mood}
      Genre: ${genre}
      Duration: ${duration} seconds
      Instruments: ${instruments.join(', ')}
      Tempo: ${tempo} BPM
      Use case: ${useCase}
      ${referenceTrack ? `Reference: ${referenceTrack}` : ''}

      Define:
      - Musical structure (intro, verses, chorus, outro)
      - Chord progression
      - Melodic themes
      - Rhythmic patterns
      - Dynamic range
      - Instrumentation details`,
    schema: {
      structure: {
        type: 'array',
        items: {
          type: 'object',
          properties: {
            section: { type: 'string' },
            duration: { type: 'number' },
            key: { type: 'string' },
            chords: { type: 'array' },
          },
        },
      },
      instrumentation: { type: 'array' },
      dynamics: { type: 'string' },
      style: { type: 'string' },
    },
  })

  // 2. Generate music (integration with AI music generation API)
  const composition = await generateMusic({
    brief: musicBrief.data,
    mood,
    genre,
    duration,
    tempo,
    instruments,
  })

  // 3. Generate variations
  const variations = await generateMusicVariations(composition, 2)

  // 4. Provide stems (individual tracks)
  const stems = await extractStems(composition)

  await send($.ServiceResult.deliver, {
    requestId: request.id,
    outputs: {
      composition: {
        url: composition.url,
        duration: composition.duration,
        format: 'mp3',
        waveform: composition.waveform,
      },
      variations,
      stems,
      brief: musicBrief.data,
      licensing: {
        type: request.inputs.licensingType || 'standard',
        terms: getLicensingTerms(request.inputs.licensingType || 'standard'),
      },
    },
  })

  const tier = musicCompositionService.pricing.tiers.find((t) => duration <= t.duration.max)
  const licensingFee = musicCompositionService.pricing.licensing[request.inputs.licensingType || 'standard']
  const totalCost = tier!.price + licensingFee

  await send($.Payment.charge, {
    customerId: request.customerId,
    amount: totalCost,
    description: `Music Composition: ${duration}s (${request.inputs.licensingType || 'standard'} license)`,
    metadata: {
      duration,
      genre,
      licensingType: request.inputs.licensingType || 'standard',
    },
  })
})

async function generateMusic(params: any) {
  // Integration with Suno, Stable Audio, MusicGen, etc.
  return {
    url: 'generated-music-url',
    duration: params.duration,
    waveform: 'waveform-data',
  }
}

async function generateMusicVariations(composition: any, count: number) {
  return Array.from({ length: count }).map((_, i) => ({
    name: `Variation ${i + 1}`,
    url: `variation-${i + 1}-url`,
    description: i === 0 ? 'Faster tempo version' : 'Alternative melody',
  }))
}

async function extractStems(composition: any) {
  return {
    drums: 'drums-stem-url',
    bass: 'bass-stem-url',
    melody: 'melody-stem-url',
    harmony: 'harmony-stem-url',
  }
}

function getLicensingTerms(type: string) {
  const terms = {
    standard: 'Personal and non-commercial use only',
    extended: 'Commercial use in videos, podcasts, and digital media',
    exclusive: 'Exclusive rights - no one else can use this composition',
  }
  return terms[type] || terms.standard
}

Social Media Asset Service

Generate complete social media content packages:

import $, { ai, db, on, send } from 'sdk.do'

const socialMediaAssetService = await $.Service.create({
  id: 'social-media-asset-generator',
  name: 'Social Media Asset Creator',
  description: 'Generate complete social media content packages with images and copy',
  type: $.ServiceType.Creative,
  subtype: 'social-media-assets',

  pricing: {
    model: 'subscription',
    tiers: [
      {
        name: 'starter',
        price: 299,
        monthly: {
          posts: 30,
          platforms: 2,
          formats: ['image', 'carousel'],
        },
      },
      {
        name: 'professional',
        price: 799,
        monthly: {
          posts: 100,
          platforms: 4,
          formats: ['image', 'carousel', 'video', 'story'],
        },
      },
      {
        name: 'agency',
        price: 1999,
        monthly: {
          posts: 500,
          platforms: 'unlimited',
          formats: ['all'],
          brandProfiles: 10,
        },
      },
    ],
  },
})

on($.ServiceRequest.created, async (request) => {
  if (request.serviceId !== socialMediaAssetService.id) return

  const { contentTheme, platforms, postCount, brandGuidelines, tone, hashtags } = request.inputs

  const posts = []

  for (let i = 0; i < postCount; i++) {
    // 1. Generate post concept
    const concept = await ai.generate({
      model: 'gpt-5',
      prompt: `Create social media post concept:

        Theme: ${contentTheme}
        Platforms: ${platforms.join(', ')}
        Brand tone: ${tone}

        Generate:
        - Hook/headline
        - Main message
        - Visual concept
        - Call to action
        - Hashtag strategy`,
      schema: {
        hook: { type: 'string' },
        message: { type: 'string' },
        visualConcept: { type: 'string' },
        cta: { type: 'string' },
        suggestedHashtags: { type: 'array' },
      },
    })

    // 2. Generate visual asset
    const visual = await generateImage({
      prompt: `${concept.data.visualConcept}. ${brandGuidelines}. Professional social media quality.`,
      resolution: '1080x1080',
      style: 'professional',
    })

    // 3. Generate platform-specific copy
    const platformCopy = await Promise.all(
      platforms.map(async (platform: string) => {
        const copy = await ai.generate({
          model: 'gpt-5',
          prompt: `Write ${platform} post copy:

            Hook: ${concept.data.hook}
            Message: ${concept.data.message}
            CTA: ${concept.data.cta}
            Brand tone: ${tone}

            Optimize for ${platform}:
            - Character limit
            - Emoji usage
            - Hashtag placement
            - Platform best practices`,
          maxTokens: 500,
        })

        return {
          platform,
          copy: copy.text,
          hashtags: concept.data.suggestedHashtags.slice(0, getHashtagLimit(platform)),
        }
      })
    )

    // 4. Generate platform-specific sizes
    const platformAssets = await generatePlatformSizes(visual, platforms)

    posts.push({
      postNumber: i + 1,
      concept: concept.data,
      visual,
      platformCopy,
      platformAssets,
      schedulingSuggestion: suggestPostTime(platforms[0], i),
    })
  }

  await send($.ServiceResult.deliver, {
    requestId: request.id,
    outputs: {
      posts,
      contentCalendar: generateContentCalendar(posts),
      analytics: {
        totalPosts: posts.length,
        platforms: platforms.length,
        estimatedReach: estimateReach(posts, platforms),
      },
    },
  })
})

async function generatePlatformSizes(image: any, platforms: string[]) {
  const sizes = platforms.flatMap((platform) => getPlatformSizes(platform))
  return Promise.all(
    sizes.map(async (size) => ({
      platform: size.platform,
      format: size.format,
      resolution: size.resolution,
      url: await resizeImage(image, size.resolution),
    }))
  )
}

function getPlatformSizes(platform: string) {
  const sizes: Record<string, any[]> = {
    instagram: [
      { format: 'feed', resolution: '1080x1080' },
      { format: 'story', resolution: '1080x1920' },
      { format: 'reels', resolution: '1080x1920' },
    ],
    facebook: [
      { format: 'feed', resolution: '1200x630' },
      { format: 'story', resolution: '1080x1920' },
    ],
    twitter: [{ format: 'post', resolution: '1200x675' }],
    linkedin: [{ format: 'post', resolution: '1200x627' }],
  }
  return (sizes[platform] || sizes.facebook).map((s) => ({ ...s, platform }))
}

async function resizeImage(image: any, resolution: string) {
  return `resized-${resolution}-url`
}

function getHashtagLimit(platform: string): number {
  const limits: Record<string, number> = {
    instagram: 30,
    twitter: 2,
    facebook: 3,
    linkedin: 3,
  }
  return limits[platform] || 5
}

function suggestPostTime(platform: string, index: number) {
  // Simple scheduling logic
  const hour = 9 + ((index * 2) % 12)
  return `Day ${Math.floor(index / 3) + 1}, ${hour}:00 AM`
}

function generateContentCalendar(posts: any[]) {
  return posts.map((post) => ({
    date: post.schedulingSuggestion,
    content: post.concept.hook,
    platforms: post.platformCopy.map((p: any) => p.platform),
  }))
}

function estimateReach(posts: any[], platforms: string[]) {
  return posts.length * platforms.length * 1000 // Simplified estimate
}

Pricing Models

Per-Asset Pricing

const pricing = {
  model: 'per-asset',
  tiers: [
    { type: 'logo', price: 299 },
    { type: 'image', price: 5 },
    { type: 'video', price: 150 },
    { type: 'music', price: 50 },
  ],
  bulk: [
    { assets: { min: 10, max: 49 }, discount: 0.1 },
    { assets: { min: 50, max: 99 }, discount: 0.2 },
    { assets: { min: 100, max: Infinity }, discount: 0.3 },
  ],
}

Subscription Pricing

const pricing = {
  model: 'subscription',
  tiers: [
    { name: 'starter', price: 299, credits: 100 },
    { name: 'professional', price: 799, credits: 300 },
    { name: 'agency', price: 1999, credits: 1000 },
  ],
  creditCosts: {
    logo: 30,
    image: 1,
    video: 15,
    music: 5,
  },
}

Project-Based Pricing

const pricing = {
  model: 'per-project',
  packages: [
    {
      name: 'brand-identity',
      price: 1999,
      includes: ['logo', 'color-palette', 'typography', 'guidelines', 'templates'],
    },
    {
      name: 'campaign',
      price: 2999,
      includes: ['10-images', '3-videos', 'copy', 'social-assets'],
    },
  ],
}

Best Practices

  1. Maintain Brand Consistency: Apply brand guidelines to all generated assets
  2. Provide Multiple Options: Generate variations for client choice
  3. Include Editable Files: Deliver source files when possible
  4. Rights Management: Clearly define usage rights and licensing
  5. Quality Control: Validate outputs meet professional standards
  6. Fast Iterations: Enable quick revisions and refinements
  7. Multi-Format Export: Provide assets in all needed formats

Real-World Use Cases

Startup

  • Challenge: Need professional brand identity on limited budget
  • Solution: Brand identity generation service
  • Result: Complete brand package for $799 vs $10,000+ from agency

Marketing Agency

  • Challenge: Produce 500+ social media assets monthly
  • Solution: Social media asset subscription service
  • Result: 70% cost reduction, 5x faster production

Content Creator

  • Challenge: Need unique background music for videos
  • Solution: Music composition service
  • Result: Original, licensed music for $50 vs $200+ per track

E-commerce Brand

  • Challenge: Create product lifestyle images at scale
  • Solution: Image generation service
  • Result: Generated 1000+ product images in 1 week