Skip to main content

Create and manage AI-powered Instagram influencers programmatically

Project description

ai-influencer

Create and manage AI-powered Instagram influencers programmatically.

pip install ai-influencer

What it does

ai-influencer lets you spin up a fully automated AI Instagram influencer with a single Python file. Give it a persona (name, niche, reference photo) and it will:

  • 🎨 Generate images of your influencer using Kie.ai (GPT Image 2) with reference-image consistency
  • 🎬 Generate Reels via a two-step pipeline: scene image → Grok image-to-video (15s, 720p)
  • 🖼️ Generate carousels where every slide looks visually consistent (same outfit, same setting)
  • ✍️ Write captions via OpenRouter (on-brand, with hashtags)
  • 📸 Post to Instagram automatically via the Meta Graph API
  • Schedule posts for a future date/time

Quick start

from influencer_ai import Influencer

# 1. Initialize (reads from .env automatically)
kai = Influencer()

# 2. Define the influencer's identity
kai.set_persona(
    name="Kai",
    gender="female",
    age=24,
    niche="fitness & lifestyle",
    tone="energetic and motivating",
    # Local file or HTTPS URL — auto-uploaded to Cloudinary
    sample_images=["path/to/reference_photo.jpg"],
)

# 3. Post a Reel (full AI pipeline)
kai.post_reel(
    prompt="Morning yoga on the beach at golden hour",
    caption="auto",
    hashtags=["#yoga", "#morningvibes"],
    improve_prompt=True,
    duration=15,
    resolution="720p",
)

# 4. Post an image
kai.post_image(
    prompt="Sitting in a cosy café, warm sunlight, candid smile",
    caption="auto",
)

# 5. Post a carousel (consistent theme across all slides)
kai.post_carousel(
    prompts=[
        "At the entrance of Taj Mahal at sunrise, excited, white salwar kameez",
        "Selfie with Taj Mahal in background, same white outfit",
        "Walking along the reflecting pool, golden hour, same outfit",
    ],
    caption="auto",
    hashtags=["#tajmahal", "#travel"],
)

# 6. Schedule a future post
kai.post_image(
    prompt="Sunset beach yoga",
    schedule="2025-12-01 07:00",
)

Environment variables

Create a .env file in your project root:

KIE_API_KEY=...
INSTAGRAM_ACCESS_TOKEN=...
INSTAGRAM_USER_ID=...
OPENROUTER_API_KEY=...        # optional — enables prompt enhancement & captions
CLOUDINARY_CLOUD_NAME=...
CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...

Or pass them directly to Influencer(kie_api_key=..., ...).


How it works

prompt
  └─► OpenRouter (enhance_prompt)
        └─► Kie.ai GPT Image 2 (scene image with reference photos)
              └─► Kie.ai Grok image-to-video (15s, 720p)
                    └─► Cloudinary (permanent hosting)
                          └─► Meta Graph API (Instagram publish)

Visual consistency: The last 5 generated posts are automatically used as reference images for future generations, keeping your influencer's appearance consistent across content.


Services required

Service Purpose Free tier
Kie.ai AI image & video generation Credits-based
Cloudinary Permanent media hosting 25 GB free
OpenRouter Caption & prompt enhancement Pay per token
Meta Graph API Instagram publishing Free

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_influencer-0.1.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_influencer-0.1.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file ai_influencer-0.1.0.tar.gz.

File metadata

  • Download URL: ai_influencer-0.1.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for ai_influencer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c69bfdd5274c171c2335dca8430011136cd9d240ef789fd6a2c24acd27a2f441
MD5 67d499c260055ab1330c1dc59a34ce99
BLAKE2b-256 992eab9e35770846063a009f941bcfb8f6276433bbaccae0a7acf14d45c38cf8

See more details on using hashes here.

File details

Details for the file ai_influencer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai_influencer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for ai_influencer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b040577ffa78e7bf5b11b2819d468e5d240c318dd49c1f03626f7cbcbb0125d1
MD5 d7617149bdfefeb48529947e92e21d4f
BLAKE2b-256 f57ec99b3ff031c27931e5ebbf7fef9b5509838f281dfc630ae2b332670829b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page