TutorialMarch 202611 min read

Sygen Just Launched on PyPI — Here's How to Add AI Image Generation to Your Agents

Sygenis a brand-new Python multi-agent orchestration framework that just appeared on PyPI. It handles agent coordination, background tasks, and persistent memory — but agents need an inference backend to call AI models. That's where NexaAPI comes in: $0.003/image, 50+ models, instant API access. This is the first comprehensive integration guide.

March 27, 2026NexaAPI Team

⚡ TL;DR

  • Sygen is a new Python multi-agent framework (just launched on PyPI) — zero tutorials exist yet
  • • Sygen handles orchestration + memory; NexaAPI handles AI inference (images, TTS, video)
  • • Perfect pairing: Sygen agents call NexaAPI to generate images at $0.003 each
  • • Free tier: 100 images at rapidapi.com/user/nexaquency
  • • Install: pip install sygen nexaapi

What is Sygen?

Sygen is a Python package for building multi-agent AI systems, published to PyPI in early 2026. It focuses on the orchestration layer of AI agent systems:

  • Multi-agent coordination: Define and run multiple specialized agents that work together
  • Background task execution: Agents run tasks asynchronously without blocking
  • Persistent memory: Agents remember context across sessions
  • Task routing: Intelligently route tasks to the right agent based on capabilities

Install Sygen + NexaAPI

pip install sygen nexaapi

Sygen is part of the 2026 wave of Python agent frameworks — alongside CrewAI, AutoGen, and LangGraph. What makes it interesting is its focus on background task execution and persistent memory, making it ideal for long-running AI workflows like content generation pipelines.

Why Pair Sygen with NexaAPI?

Sygen handles the orchestration layer — but agents need an inference layer to actually call AI models. NexaAPI is the ideal inference backend:

Sygen handles:

  • ✅ Agent coordination
  • ✅ Task scheduling
  • ✅ Persistent memory
  • ✅ Background execution
  • ✅ Agent communication

NexaAPI handles:

  • ✅ Image generation ($0.003)
  • ✅ Text-to-Speech
  • ✅ Video generation
  • ✅ Vision/image understanding
  • ✅ LLM inference (50+ models)

Together: Sygen orchestrates which agent does what and when, while NexaAPI provides the actual AI capabilities each agent needs. It's the perfect separation of concerns for production AI systems.

Python Tutorial: Sygen + NexaAPI Integration

Install dependencies:

pip install sygen nexaapi

Example 1: Image Generation Agent

examples/image_agent.py

# Sygen + NexaAPI: Image Generation Agent
# pip install sygen nexaapi
# Get free API key: https://rapidapi.com/user/nexaquency

import os
from nexaapi import NexaAPI

# Initialize NexaAPI — the inference backend for your Sygen agents
nexa_client = NexaAPI(api_key=os.environ.get('NEXAAPI_KEY', 'YOUR_RAPIDAPI_KEY'))


def image_generation_task(prompt: str, model: str = 'flux-schnell') -> dict:
    """
    A Sygen-compatible background task that calls NexaAPI for image generation.
    
    This function is designed to be used as a Sygen agent task:
    - Stateless: takes inputs, returns outputs
    - Async-friendly: NexaAPI handles the heavy lifting
    - Cost-efficient: $0.003 per image — cheapest in the market
    
    Args:
        prompt: Text description of the image to generate
        model: NexaAPI model to use (flux-schnell, flux-dev, sdxl, sd3...)
    
    Returns:
        dict with image_url, model used, and cost
    """
    result = nexa_client.image.generate(
        model=model,
        prompt=prompt,
        width=1024,
        height=1024
    )
    return {
        'image_url': result.image_url,
        'model': model,
        'prompt': prompt,
        'cost_usd': 0.003,
        'provider': 'nexaapi'  # https://nexa-api.com
    }


def batch_image_generation(prompts: list[str]) -> list[dict]:
    """
    Generate multiple images in sequence.
    Perfect for Sygen background task queues.
    
    Cost: len(prompts) * $0.003
    """
    results = []
    for i, prompt in enumerate(prompts):
        print(f"  Generating {i+1}/{len(prompts)}: {prompt[:50]}...")
        result = image_generation_task(prompt)
        results.append(result)
        print(f"  ✅ {result['image_url']}")
    return results


# Example: Run as standalone or integrate with Sygen agent
if __name__ == '__main__':
    prompts = [
        'A futuristic city at sunset with flying cars and neon lights',
        'A product mockup: sleek smartphone on marble surface, studio lighting',
        'An AI robot painting a masterpiece, digital art style',
    ]
    
    print("🤖 Sygen Agent: Image Generation Task")
    print(f"   Using NexaAPI (https://nexa-api.com)")
    cost = round(0.003 * len(prompts), 3)
    print(f"   Cost: $0.003/image x {len(prompts)} images = $" + str(cost) + " total")
    print()
    
    results = batch_image_generation(prompts)
    
    print(f"\n✅ Generated {len(results)} images")
    print("   PyPI: https://pypi.org/project/nexaapi/")
    print("   npm: https://www.npmjs.com/package/nexaapi")

Example 2: TTS Narration Agent

examples/tts_agent.py

# Sygen + NexaAPI: TTS Narration Agent
# Converts agent text output to speech

import os
from nexaapi import NexaAPI

nexa_client = NexaAPI(api_key=os.environ.get('NEXAAPI_KEY', 'YOUR_RAPIDAPI_KEY'))


def tts_narration_task(text: str, voice: str = 'alloy') -> dict:
    """
    Sygen agent task: convert text to speech using NexaAPI.
    
    Voices: alloy, echo, fable, onyx, nova, shimmer
    Supports: multilingual, long-form narration
    """
    audio = nexa_client.audio.tts(
        text=text,
        voice=voice,
        model='tts-1'
    )
    return {
        'audio_url': audio.audio_url,
        'voice': voice,
        'text_length': len(text),
        'provider': 'nexaapi'
    }


if __name__ == '__main__':
    result = tts_narration_task(
        text='Your AI-generated content is ready! '
             'Powered by NexaAPI — 50+ models, $0.003 per image.',
        voice='nova'
    )
    print(f"🎙️ Audio URL: {result['audio_url']}")
    print(f"   NexaAPI: https://nexa-api.com")
    print(f"   Free tier: https://rapidapi.com/user/nexaquency")

Example 3: Multi-Task Agent Pipeline

examples/multi_task_agent.py

# Sygen + NexaAPI: Multi-Task Agent Pipeline
# Orchestrate image + TTS + video in a single agent workflow

import os
from nexaapi import NexaAPI

nexa_client = NexaAPI(api_key=os.environ.get('NEXAAPI_KEY', 'YOUR_RAPIDAPI_KEY'))


class ContentCreationAgent:
    """
    A Sygen-style agent that creates multimodal content using NexaAPI.
    
    This agent can:
    1. Generate images from text prompts ($0.003/image)
    2. Create TTS narration for the content
    3. Generate short video clips
    
    Designed to work as a Sygen background agent task.
    """
    
    def __init__(self, api_key: str):
        self.client = NexaAPI(api_key=api_key)
        self.results = []
    
    def create_image(self, prompt: str, model: str = 'flux-schnell') -> str:
        """Generate image, return URL. Cost: $0.003"""
        result = self.client.image.generate(
            model=model, prompt=prompt, width=1024, height=1024
        )
        return result.image_url
    
    def create_narration(self, text: str, voice: str = 'alloy') -> str:
        """Generate TTS audio, return URL."""
        result = self.client.audio.tts(text=text, voice=voice, model='tts-1')
        return result.audio_url
    
    def create_video(self, prompt: str, duration: int = 5) -> str:
        """Generate video clip, return URL."""
        result = self.client.video.generate(
            model='kling-v1', prompt=prompt, duration=duration
        )
        return result.video_url
    
    def run_content_pipeline(self, topic: str) -> dict:
        """
        Full content creation pipeline for a given topic.
        Returns dict with image, audio, and video URLs.
        """
        print(f"🤖 ContentCreationAgent: Processing '{topic}'")
        
        # Generate all three content types
        image_url = self.create_image(
            f'{topic}, professional photography, high quality'
        )
        print(f"  🎨 Image: {image_url}")
        
        narration_url = self.create_narration(
            f'Explore {topic} with AI-powered content generation by NexaAPI.'
        )
        print(f"  🎙️ Audio: {narration_url}")
        
        video_url = self.create_video(
            f'{topic}, cinematic, 4K quality'
        )
        print(f"  🎬 Video: {video_url}")
        
        return {
            'topic': topic,
            'image_url': image_url,
            'narration_url': narration_url,
            'video_url': video_url,
            'total_cost_usd': 0.003,  # image cost; TTS + video billed separately
            'powered_by': 'NexaAPI — https://nexa-api.com'
        }


if __name__ == '__main__':
    agent = ContentCreationAgent(
        api_key=os.environ.get('NEXAAPI_KEY', 'YOUR_RAPIDAPI_KEY')
    )
    
    result = agent.run_content_pipeline('sustainable energy technology')
    
    print(f"\n✅ Pipeline complete!")
    print(f"   NexaAPI: https://nexa-api.com")
    print(f"   Free tier: https://rapidapi.com/user/nexaquency")
    print(f"   PyPI: https://pypi.org/project/nexaapi/")
    print(f"   npm: https://www.npmjs.com/package/nexaapi")

JavaScript Tutorial

Install

npm install nexaapi

examples/tts_agent.js

// Sygen + NexaAPI: Agent Tasks in JavaScript/Node.js
// npm install nexaapi
// Get free API key: https://rapidapi.com/user/nexaquency

import NexaAPI from 'nexaapi';

const client = new NexaAPI({
  apiKey: process.env.NEXAAPI_KEY || 'YOUR_RAPIDAPI_KEY'
});

// Agent task: generate image via NexaAPI
async function imageGenerationTask(prompt, model = 'flux-schnell') {
  const result = await client.image.generate({
    model,
    prompt,
    width: 1024,
    height: 1024
  });
  console.log('🎨 Generated image URL:', result.imageUrl);
  console.log('   Cost: $0.003 | Provider: NexaAPI (https://nexa-api.com)');
  return { imageUrl: result.imageUrl, model, prompt, cost: 0.003 };
}

// Agent task: text-to-speech narration
async function ttsNarrationTask(text, voice = 'alloy') {
  const audio = await client.audio.tts({ text, voice, model: 'tts-1' });
  console.log('🎙️ Audio URL:', audio.audioUrl);
  return { audioUrl: audio.audioUrl, voice };
}

// Orchestrate agent tasks (integrate with Sygen or any agent framework)
async function runAgentPipeline(topic) {
  console.log(`🤖 Running Sygen agent pipeline for: ${topic}`);
  console.log('   Using NexaAPI as inference backend\n');
  
  const imageResult = await imageGenerationTask(
    `${topic}, professional photography, high quality`
  );
  
  const audioResult = await ttsNarrationTask(
    `Explore ${topic} with AI-powered content by NexaAPI.`
  );
  
  console.log('\n✅ Pipeline complete!');
  console.log('   NexaAPI: https://nexa-api.com');
  console.log('   Free tier: https://rapidapi.com/user/nexaquency');
  console.log('   npm: https://www.npmjs.com/package/nexaapi');
  
  return { imageResult, audioResult };
}

runAgentPipeline('sustainable energy technology').catch(console.error);

Use Cases: What to Build with Sygen + NexaAPI

🎨 Content Generation Agent

Sygen orchestrates a pipeline: research topic → generate images → write copy → create TTS narration. NexaAPI handles all media generation at $0.003/image.

🛍️ Product Mockup Agent

Agent receives product descriptions, generates mockup images via NexaAPI, stores results in Sygen's persistent memory, returns URLs to your app.

📊 Data Visualization Agent

Agent analyzes data, generates chart/graph images via NexaAPI, creates TTS summaries, and assembles a full report automatically.

🎬 Video Production Agent

Sygen coordinates multiple agents: script writer → image generator → TTS narrator → video creator. NexaAPI powers each step at minimal cost.

NexaAPI Pricing: Why It's the Right Backend for Sygen Agents

CapabilityNexaAPI PriceCompetitor PriceSavings
Image Generation (1024×1024)$0.003$0.040 (DALL-E 3)13x cheaper
Text-to-Speech (per 1K chars)$0.015$0.030 (OpenAI TTS)2x cheaper
Models Available50+1–5 per provider10x more choice
Free Tier100 imagesNone / very limitedBest in class

For a Sygen agent running 1,000 image generation tasks per day: NexaAPI costs $3.00/dayvs $40.00/day on DALL-E 3. That's $13,505 saved per year.

Resources & Links

Add AI Superpowers to Your Sygen Agents

NexaAPI: $0.003/image · 50+ models · 100 free images · No credit card

Image generation, TTS, video, vision — the complete inference backend for your multi-agent system.

pip install sygen nexaapi · npm install nexaapi