Skip to main content

AceDataCloud Python SDK

Official Python client for the AceDataCloud API.

Installation

pip install acedatacloud

Quick Start

from acedatacloud import AceDataCloud

client = AceDataCloud(api_token="your-token")

# OpenAI-compatible chat completions
response = client.openai.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response["choices"][0]["message"]["content"])

# Streaming
for chunk in client.openai.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Tell me a story"}],
    stream=True,
):
    print(chunk.get("choices", [{}])[0].get("delta", {}).get("content", ""), end="")

Async Usage

import asyncio
from acedatacloud import AsyncAceDataCloud


async def main():
    client = AsyncAceDataCloud(api_token="your-token")
    result = await client.search.google(query="Python SDK")
    print(result)
    await client.close()


asyncio.run(main())

Resources

Resource Description
client.openai OpenAI-compatible chat completions and responses
client.chat Native chat messages
client.images Image generation (Flux, Seedream, Nano Banana, etc.)
client.audio Music generation (Suno)
client.video Video generation (Luma, Sora, Veo, etc.)
client.search Web search (Google SERP)
client.face Face analysis & transformation (swap, beautify, age, cartoon)
client.shorturl Short URL creation
client.tasks Cross-service async task polling
client.files File uploads
client.platform Applications, credentials, models management

Image Generation (with Task Polling)

# Default provider (nano-banana)
task = client.images.generate(prompt="A sunset over mountains")
result = task.wait()  # polls until complete
print(result["image_url"])

# Use a specific provider
flux_task = client.images.generate(prompt="A sunset over mountains", provider="flux")

Multi-Provider Support

Image, video, and audio resources support a provider parameter to switch between services:

# Video — default is 'sora'
client.video.generate(prompt="A cat playing piano", provider="kling")
client.video.generate(prompt="Ocean waves", provider="luma")

# Audio — default is 'suno'
client.audio.generate(prompt="A jazz song", provider="producer")

Available providers:

Resource Providers
client.images nano-banana (default), flux, seedream
client.video sora (default), luma, veo, kling, hailuo, seedance, wan, pika, pixverse
client.audio suno (default), producer, fish

Error Handling

from acedatacloud import AceDataCloud, AuthenticationError, RateLimitError

client = AceDataCloud(api_token="your-token")
try:
    client.search.google(query="test")
except AuthenticationError:
    print("Invalid or expired token")
except RateLimitError:
    print("Too many requests, slow down")

Configuration

client = AceDataCloud(
    api_token="your-token",
    base_url="https://x402.acedata.cloud",  # API gateway (default)
    platform_base_url="https://platform.acedata.cloud",  # Management plane
    timeout=300.0,  # Request timeout in seconds
    max_retries=2,  # Retry count for transient errors
)

The token can also be set via the ACEDATACLOUD_API_TOKEN environment variable.

Paying with X402 Instead of a Bearer Token

The SDK supports a pluggable payment_handler that is invoked when the API returns 402 Payment Required. Any callable (or async callable) that returns the required headers is accepted:

from acedatacloud import AceDataCloud, PaymentHandlerContext, PaymentHandlerResult


def my_payment_handler(ctx: PaymentHandlerContext) -> PaymentHandlerResult:
    # ctx["accepts"] is the list of payment requirements returned by the server.
    # Your job: sign the preferred one and return the retry header.
    x_payment = sign_and_encode(ctx["accepts"])  # your implementation
    return {"headers": {"X-Payment": x_payment}}


client = AceDataCloud(payment_handler=my_payment_handler)

# Normal SDK calls — the handler is only invoked when the server returns 402.
result = client.openai.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hi"}],
)

The AsyncAceDataCloud client accepts either a synchronous or asynchronous handler. For a ready-made signer, install acedatacloud-x402 and pass its handler directly:

from acedatacloud import AceDataCloud
from acedatacloud_x402 import EVMAccountSigner, create_x402_payment_handler

client = AceDataCloud(
    payment_handler=create_x402_payment_handler(
        network="base",
        evm_signer=EVMAccountSigner.from_private_key("0x..."),
        prefer_scheme="upto",
    )
)

See AceDataCloud/X402Client for Base, Solana, and SKALE setup details.

License

MIT

Download files

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

Source Distribution

acedatacloud-2026.9.10.0.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

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

acedatacloud-2026.9.10.0-py3-none-any.whl (58.4 kB view details)

Uploaded Python 3

File details

Details for the file acedatacloud-2026.9.10.0.tar.gz.

File metadata

  • Download URL: acedatacloud-2026.9.10.0.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for acedatacloud-2026.9.10.0.tar.gz
Algorithm Hash digest
SHA256 f6a27323e0c103747128a94ccb32cae2c6c62c528c05073b2a5a54fc0b2d3183
MD5 baa186c65d86ee4ccdda16f6d74b7845
BLAKE2b-256 80f1bbf65b3c45a4273c91f1163e6bae8efd921344e599a6eb522751f6b5f97c

See more details on using hashes here.

File details

Details for the file acedatacloud-2026.9.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for acedatacloud-2026.9.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01598c3d29ce6f71dcf69d0860131cb4d1f47a46cea542546e996790dea25426
MD5 8ae520b601235aaa53f5fc4556de3095
BLAKE2b-256 1f70aab1d4ce9488b39f1bfc8ce86dc02b0157b0fe667a821b6330d59b6d9db1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2026.9.10.0 This release

2 files

2026.9.9.0

2 files

2026.9.5.1

2 files

2026.9.5.0

2 files

2026.8.24.0

2 files

2026.8.17.0

2 files

2026.8.14.0

2 files

2026.8.11.0

2 files

2026.8.10.0

2 files

2026.8.9.1

2 files

2026.8.9.0

2 files

2026.8.7.0

2 files

2026.8.5.0

2 files

2026.8.4.0

2 files

2026.8.1.0

2 files

2026.7.28.0

2 files

2026.7.27.3

2 files

2026.7.27.2

2 files

2026.7.27.1

2 files

2026.7.27.0

2 files

2026.7.22.0

2 files

2026.7.18.1

2 files

2026.7.18.0

2 files

2026.7.16.1

2 files

2026.7.16.0

2 files

2026.6.29.0

2 files

2026.6.27.0

2 files

2026.6.14.0

2 files

2026.6.6.0

2 files

2026.4.26.1

2 files

2026.4.26.0

2 files

2026.4.24.0

2 files

2026.4.20.0

2 files

2026.4.19.0

2 files

2026.4.18.2

2 files

2026.4.18.1

2 files

2026.4.18.0

2 files

2026.3.22.1

2 files

2026.3.22.0

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