Skip to main content

Python client for the Creacortex video-creative attention-analysis API

Project description

creacortex

Python client for the Creacortex video-creative attention-analysis API.

Upload a video creative, run it through the pipeline, and pull back per-second attention data, a Gen-AI optimization payload, and PDF reports.

Install

pip install creacortex

Quick start

from creacortex import Client

with Client("ace_your_api_key") as cx:
    # one call: upload + start + wait for completion
    run = cx.analyze("ad.mp4", with_audio=True, creative_id="summer-promo")

    csv = cx.get_csv(run.run_id)                 # per-second analysis (bytes)
    payload = cx.get_export(run.run_id)          # Gen-AI insights (dict)
    pdf = cx.get_report(run.run_id, "diagnose")  # PDF report (bytes)

Get an API key from Usage & billing → API keys in the dashboard. It is sent as the X-API-Key header.

Async

import asyncio
from creacortex import AsyncClient

async def main():
    async with AsyncClient("ace_your_api_key") as cx:
        run = await cx.analyze("ad.mp4")
        print(await cx.get_export(run.run_id))

asyncio.run(main())

Step by step

analyze() is a convenience over the raw endpoints, which you can also call directly:

video_id = cx.upload_video("ad.mp4")
run = cx.create_run(video_id, with_audio=True, audience="men 20-45, mobile gamers")
run = cx.wait(run.run_id)                # poll until done (or RunFailedError / WaitTimeout)

for item in cx.list_runs():
    print(item.run_id, item.status, item.ready)

print(cx.get_account().balance)          # credits left

upload_video / analyze accept a file path, raw bytes, or a binary file object.

Errors

Exception When
AuthError invalid/missing API key (401)
InsufficientCreditsError not enough credits (402)
RateLimitError too many requests (429)
NotFoundError unknown run (404)
RunFailedError the run finished with status="failed"
WaitTimeout wait() exceeded its timeout
ApiError any other HTTP error (has .status_code)

All inherit from CreacortexError.

Configuration

Client("ace_...", base_url="https://api.creacortex.ai", timeout=60.0)

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

creacortex-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

creacortex-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: creacortex-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for creacortex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 beec8da012dd60d69e37b5c66012649d3a7c8fe1a2a93a38d0272435f3cf88ae
MD5 afc9f7f350ecbb4bfe17ae30c1955199
BLAKE2b-256 e5cfaf05005472b4617e4ddaccfb45a8ccd0a5ff4a7b3af9dafb9884930c4070

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for creacortex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 729fe04c9aa8af630a83e15e551588593832e5553e94588d8bae39dba1ba8897
MD5 2ebafec24e27b4f103e8d80d5e85edc4
BLAKE2b-256 a4b4e7da42b76cb078e87a2ac2b3eb4eb061dbdaf2de35227aee919ff51683cd

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