Skip to main content

Fraime SDK

Python client for the Fraime API — build a request with typed models/enums instead of hand-writing JSON, point it at a running Fraime instance, get a generated video back.

Prerequisites

  • Python 3.11+
  • A running Fraime API instance to talk to (see api/README.md for how to run one) — you'll need its base URL, and its API key if one is configured (AUTH_API_KEY on the API side).

Install

Option 1 — pip

pip install fraime-sdk

Option 2 — from a local clone

Step by step, from scratch:

# 1. Clone the repo (skip if you already have it)
git clone <this-repo-url>
cd fraime

# 2. (Recommended) create a virtualenv for your own project
python3 -m venv .venv
source .venv/bin/activate

# 3. Install the SDK from the sdk/ folder
pip install ./sdk
#   or, for local development on the SDK itself (editable install):
pip install -e ./sdk

That's it — import fraime is now available in that environment.

Option 3 — straight from git, no local clone needed

pip install "git+ssh://git@santiago/santiagoMeloMedina/fraime.git#subdirectory=sdk"

(Adjust the URL to whatever remote you actually have push/pull access to — this is this repo's own origin in SSH form.)

Usage

from fraime import FraimeClient, VideoType, GenerationParams, CinematicPromptFields

client = FraimeClient(
    base_url="http://127.0.0.1:8000",  # or set FRAIME_BASE_URL instead
    api_key="your-api-key",             # or set FRAIME_API_KEY instead; omit both if the API has none configured
)

response = client.generate(
    video_type=VideoType.PIXAR,
    fields=CinematicPromptFields(
        subject="a small orange fox with oversized ears",
        action="hops between rocks, pauses, and looks up curiously",
        scene="a sunlit forest clearing at golden hour",
        camera="medium shot, slow dolly-in",
        lighting="warm rim lighting from the low sun",
        style="3D animated feature style, stylized proportions, warm rim lighting",
    ),
    params=GenerationParams(duration_s=3, fps=16, resolution="768x512"),
    # model=...              # optional: pin an exact model instead of auto-selecting
    # references=[...]       # optional: Reference(url=...) list, for image-to-video
)

print(response.video_path, response.model)

model is optional on client.generate() — omit it and the API auto-selects by hardware, same as calling it directly.

Picking the right fields class per video type

Every video_type has its own field set — some add fields the base six (subject, action, scene, camera, lighting, style, negative_prompt) don't cover:

VideoType Fields class Extra fields
PIXAR, ACTION, ANIMATION, ANIME, DOCUMENTARY, FASHION CinematicPromptFields
UGC_PRODUCT_REVIEW, COMMERCIAL_PRODUCT_AD, EXPLAINER_TESTIMONIAL UGCPromptFields dialogue, reference_image
PRESENTER_AVATAR PresenterPromptFields + voice_tone
SOCIAL_SHORT_FORM_AD SocialAdPromptFields + text_overlay, aspect_ratio
MUSIC_VIDEO MusicVideoPromptFields audio_reference, tempo_bpm
MOTION_GRAPHICS MotionGraphicsPromptFields text_content, transitions

Not sure which class a given VideoType needs? Look it up instead of guessing:

from fraime import PROMPT_FIELDS_BY_VIDEO_TYPE, VideoType

fields_class = PROMPT_FIELDS_BY_VIDEO_TYPE[VideoType.SOCIAL_SHORT_FORM_AD]
# -> SocialAdPromptFields

Reference images (image-to-video)

from fraime import Reference

response = client.generate(
    video_type=VideoType.UGC_PRODUCT_REVIEW,
    fields=ugc_fields,
    params=params,
    references=[Reference(url="https://example.com/product-photo.jpg")],
)

Error handling

from fraime import FraimeAuthError, FraimeAPIError, FraimeConnectionError

try:
    response = client.generate(video_type=VideoType.PIXAR, fields=fields, params=params)
except FraimeAuthError:
    ...  # missing/invalid API key
except FraimeAPIError as e:
    ...  # e.status_code, e.detail — the API reached but returned an error
except FraimeConnectionError:
    ...  # couldn't reach the API at all

Configuration reference

FraimeClient(...) argument Env var fallback Default
base_url FRAIME_BASE_URL http://127.0.0.1:8000
api_key FRAIME_API_KEY none (open API)
timeout 600.0 seconds

timeout defaults high on purpose — real generation runs can take several minutes; see api/README.md for why.

Download files

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

Source Distribution

fraime_sdk-1.0.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

fraime_sdk-1.0.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file fraime_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: fraime_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for fraime_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 75ee997e53da9627d0d60d11cfdd62d0da650de879f9f6beb7f277ef97cd1756
MD5 709ab9710bb8674b1ced035dc86f03fc
BLAKE2b-256 18756ec7bda731fee90053d395f004992ed18f077b2e9ba2c5bb073db9eb3187

See more details on using hashes here.

File details

Details for the file fraime_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fraime_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for fraime_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca054eede20b66d3d637e830deb7a32aeceb8d97f524b7e241977a19bb99fd7
MD5 2e664c276f197adc4942eb990e64500f
BLAKE2b-256 042ddf4fd7702f2babd6a31f9262a98a60c0b9c0fd19d27993dc11fba642dd23

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

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