Skip to main content

getplantain

Official Python SDK for Plantain — generate Nano Banana 2.1 1K PNG images (€0.02 each, less in bulk) and 4–8 second MP4 video clips with sound (€0.16 each, 720p or 1080p) in a few lines of Python.

  • Handles submit, polling, and download automatically (sync and async)
  • No Google Cloud account or billing setup required
  • Pay-as-you-go in euros, no monthly subscription
  • New accounts get 5 free credits at getplantain.com/signin
  • Failed or refused generations are automatically refunded

Plantain is an independent service and is not affiliated with or endorsed by Google.

Installation

pip install getplantain

Requires Python 3.10+.

Quick start

  1. Sign in with Google at getplantain.com/signin to get an API key (includes 5 free credits).
  2. Set PLANTAIN_API_KEY in your environment (or pass api_key=... directly).
from plantain import Plantain

with Plantain() as client:
    # Generate a 1K PNG image (1 credit)
    image = client.generate_image(
        "A ceramic teapot and two cups on a linen tablecloth, soft morning light",
        aspect_ratio="16:9",
    )
    image.save("teapot.png")
    print(f"Job {image.job.id}, credits left: {image.job.credits_left}")

    # Generate a video clip with sound (8 credits)
    video = client.generate_video(
        "Waves rolling onto a rocky shore at golden hour, seagulls calling",
        duration_s=8,
        aspect_ratio="16:9",
        resolution="1080p",
    )
    video.save("waves.mp4")

    # Check account balance
    account = client.get_account()
    print(f"{account.name}: {account.credits} credits remaining")

Async usage

import asyncio
from plantain import AsyncPlantain

async def main() -> None:
    async with AsyncPlantain() as client:
        image = await client.generate_image("A sunlit ceramic bowl of ripe plantains")
        image.save("plantains.png")

asyncio.run(main())

Step-by-step submit, poll, and download

If you want to store job IDs or poll separately:

from plantain import Plantain

with Plantain() as client:
    job = client.submit_image("Minimalist lighthouse at dusk", aspect_ratio="3:4")
    print("Submitted:", job.id, "credits left:", job.credits_left)

    done = client.wait_for_image(job.id)
    png_bytes = client.download_image(done.id)

The same methods exist for video: submit_video, get_video, wait_for_video, and download_video.

API reference

Plantain / AsyncPlantain

Constructor options:

  • api_key: Bearer API key (defaults to PLANTAIN_API_KEY)
  • base_url: API base URL (defaults to PLANTAIN_API_URL or https://getplantain.com)
  • poll_interval: Seconds between status checks while waiting (default 2.0)
  • image_timeout: Max wait in seconds for generate_image / wait_for_image (default 600.0)
  • video_timeout: Max wait in seconds for generate_video / wait_for_video (default 900.0)
  • request_timeout: HTTP timeout in seconds per request (default 60.0)

Methods:

Method Endpoint Cost Returns
generate_image(prompt, *, aspect_ratio="1:1", tier="standard", ...) POST + poll + GET /content 1 credit GeneratedImage (.job, .data, .content_type, .save(path))
submit_image(prompt, *, aspect_ratio="1:1", tier="standard") POST /v1/images 1 credit ImageJob
get_image(job_id) GET /v1/images/{id} — ImageJob
wait_for_image(job_id, *, poll_interval=..., timeout=...) GET /v1/images/{id} — ImageJob
download_image(job_id) GET /v1/images/{id}/content — bytes
generate_video(prompt, *, duration_s=8, aspect_ratio="16:9", resolution="720p", ...) POST + poll + GET /content 8 credits GeneratedVideo (.job, .data, .content_type, .save(path))
submit_video(prompt, *, duration_s=8, aspect_ratio="16:9", resolution="720p") POST /v1/videos 8 credits VideoJob
get_video(job_id) GET /v1/videos/{id} — VideoJob
wait_for_video(job_id, *, poll_interval=..., timeout=...) GET /v1/videos/{id} — VideoJob
download_video(job_id) GET /v1/videos/{id}/content — bytes
get_account() GET /v1/account — Account

Supported image aspect ratios: "1:1" (1024×1024, default), "16:9", "4:3", "3:4", "9:16".
Supported video options: duration_s in 4, 6, 8 (default 8); aspect_ratio in "16:9" (default), "9:16"; resolution in "720p" (default), "1080p".

Error handling

All SDK exceptions inherit from PlantainError (with .status_code, .retry_after, .detail, and .job where applicable):

  • AuthenticationError (HTTP 401 or missing API key)
  • InsufficientCreditsError (HTTP 402)
  • NotFoundError (HTTP 404)
  • ConflictError (HTTP 409, content requested before job succeeded)
  • GoneError (HTTP 410, output no longer available)
  • ValidationError (HTTP 422)
  • RateLimitError (HTTP 429, sets .retry_after in seconds when provided)
  • JobFailedError (job finished with status "failed"; credits are refunded automatically)
  • PlantainTimeoutError (polling or HTTP request exceeded timeout)
from plantain import InsufficientCreditsError, Plantain, PlantainError, RateLimitError

client = Plantain()
try:
    image = client.generate_image("A wooden sailboat on calm water")
except InsufficientCreditsError:
    print("Out of credits — top up at https://getplantain.com/account")
except RateLimitError as err:
    print(f"Queue busy — retry after {err.retry_after}s")
except PlantainError as err:
    print(f"API error: {err}")

Pricing

  • 1 credit = one 1K image (Nano Banana 2.1, PNG)
  • 8 credits = one 4–8s video clip with sound (720p or 1080p, MP4)
  • Credit packs: 1,000 credits for €20 (€0.02/image), 5,500 for €100 (€0.018), 31,000 for €500 (€0.016). Credits last 12 months from your last purchase.

Development

pip install -e ".[dev]"
pytest

Support

Questions or feedback: hello@getplantain.com · getplantain.com/docs

Metadata

Release files for getplantain 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for getplantain 0.1.0
File Size Uploaded Provenance Actions
getplantain-0.1.0.tar.gz 14.7 kB With provenance Details for getplantain-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for getplantain 0.1.0
File Interpreter ABI Platform Actions
getplantain-0.1.0-py3-none-any.whl Python 3 none any Details for getplantain-0.1.0-py3-none-any.whl

Total release size: 27.5 kB

Release files / getplantain-0.1.0.tar.gz

Download URL getplantain-0.1.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e6f19574e0c634bc03a0e2932a119fd9babe7d3c6abb9c060c6cc1448d0f3685
BLAKE2b-256 checksum
How to use checksums
bad3ead5e4af86cc7957b0462ef28b2cb725d3cb39f7a96358a80ac1f5202002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / getplantain-0.1.0-py3-none-any.whl

Download URL getplantain-0.1.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1021105cf5e577b9b79e0d656241251db8407ec117defbce70b98d16d2f8dc7
BLAKE2b-256 checksum
How to use checksums
3905abed258e9c109f1a8ad4b2c1a52adf83b278dcb445f4abef8dc4b8c94028
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for getplantain 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for getplantain-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page