AceDataCloud Python SDK
Official Python client for the AceDataCloud API.
Get your Ace Data Cloud API key
- Open Ace Data Cloud → Applications. Sign in, or register an account first.
- Find General application. If it has not been created, choose Initialize General Application. A general key can use the services available to your account; a dedicated application's key is limited to its service. Check the required service/model access and current pricing.
- Click the copy button beside API KEY. Pass only the raw value to the SDK, without spaces, quotation marks or
Bearer. Confirm the application balance can cover the request; any trial allowance is whatever your account displays. A platform-... account token cannot replace this generation key.

See the detailed API key guide for permissions, limits and expiration.
Save the key in the client's credential store or the environment variable shown below. Never put it in a prompt, shared workflow, screenshot, or Git commit. If authentication fails, check the full copied value, application/service access, expiration, usage limit, and balance before creating another key.
Use this application key for API requests. SDK account-management methods require the separate credential described in their management documentation; do not interchange it with the API key. The optional x402 payment flow below is a separate way to pay for supported requests.
Installation
pip install acedatacloud
Quick Start
from acedatacloud import AceDataCloud
client = AceDataCloud(api_token="YOUR_API_TOKEN", base_url="https://api.acedata.cloud")
response = client.openai.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response["choices"][0]["message"]["content"])
Recorded response excerpt from the public Chat Completions guide; text and usage vary:
{
"model": "gpt-5.5",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "Hello! What can I help you with today?", "refusal": null, "annotations": []}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 7, "completion_tokens": 13, "total_tokens": 20}
}
The reply is in choices[0].message.content.
Optional project keys
For independently revocable credentials, use Keys / Manage Keys → Create and review allowed APIs, limits and expiration in the key guide.
Unified chat protocols
| Method |
Protocol |
client.chat.completions.create(...) |
/v1/chat/completions |
client.responses.create(...) |
/v1/responses |
client.chat.messages.create(...) |
/v1/messages |
These methods use Bearer authentication and preserve explicit model IDs without
fallback. Choose a protocol published for your model; a single API's suggestions
are not the entire catalog. AsyncAceDataCloud exposes the same methods. All
three support stream=True; await the async method before iterating its async
stream. Existing client.openai methods keep their original routes. Calls use
your application balance according to current pricing.
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
For a runnable LlamaIndex workflow, see search, extraction and cited retrieval
(中文). It uses the published SDK, runs offline by default,
and includes a read-only hosted MCP discovery command.
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 |
Chat usage and billing
Accepted model requests through Chat Completions, Responses, and Messages are
billed by the selected model's input, output, and cache usage, not a fixed fee
per request. Switching protocol formats does not change this to per-call billing
or guarantee that a model accepts that format. Consult current model prices and
usage.cost for the charge; the SDK preserves reported usage without recalculating it.
- Chat Completions
prompt_tokens includes reported cached tokens.
- Responses
input_tokens includes reported cached tokens.
- Messages
input_tokens excludes separately reported cache_read_input_tokens
and cache_creation_input_tokens; those dimensions are charged separately.
Do not add cached tokens to the input total again for Chat Completions or
Responses, or treat Messages input alone as the full input/cache usage.
Public Chat Completions models
Pass these public IDs to client.openai.chat.completions.create(model=..., messages=...)
(or await with AsyncAceDataCloud); use stream=True for streaming. The SDK
passes model-specific fields through without rewriting model IDs or enforcing a catalog.
gpt-6.1-terra: supports text/image input, streaming, function tools, and
structured output. Use reasoning_effort="low" initially; supported levels are
low, medium, high, xhigh, and max, not none or minimal. Responses uses
reasoning={"effort": "low"} instead. Inputs over 272,000 tokens use long-context
pricing; consult current prices and reported usage.
claude-opus-5-5: supports text and streaming Chat Completions with n=1.
Omit temperature and top_p to use model defaults; do not set temperature below
1 or a non-default top-p. Use tool_choice="auto", not forced tools. For native
thinking blocks, signatures, and native tool semantics, use client.chat.messages.
gemini-4-argon: supports text and streaming Chat Completions. Thinking can
consume output budget; Google recommends at least max_tokens=32768 for ordinary
tasks. This does not expose Interactions background long-output functionality.
kimi-k3.1-pro: always reasons; pass reasoning_effort="low", "high", or "max".
Do not disable reasoning. Keep the full assistant message, including
reasoning_content and tool_calls, in multi-turn and tool-call history.
The existing kimi-k3 alias remains available; use reasoning_effort="max" for it.
Check current account access and prices before calling. A model's advertised
context size does not guarantee the platform's per-request limit.
Gemini and GPT-6.2 protocols
The unified Chat Completions, Responses and Messages methods accept
gemini-3.8-flash, gemini-4-argon, gemini-4-carbon, gemini-4-hydrogen,
gemini-4-neon, gpt-6.2-astra and gpt-6.2-sol without rewriting their IDs.
Account access and current model prices still apply.
For Gemini Responses, omit store or set store=False, omit
previous_response_id, and keep conversation history in input. The client must
execute function tools, retain the previous input and complete output items, and
append function_call_output with the matching call_id. Read ordinary text from
output message items' output_text blocks, or streaming text from
response.output_text.delta events. See the
Responses guide.
For GPT-6.2, start with reasoning_effort="low" in Chat Completions or
reasoning={"effort": "low"} in Responses. Supported levels are low, medium,
high, xhigh and max, not none or minimal. Inputs over 272,000 tokens use
long-context pricing; the advertised context size does not override request limits.
Native Claude Messages
For structured output, pass
output_config={"format": {"type": "json_schema", "schema": your_schema}} to
client.chat.messages.create(...). Read the generated JSON from Messages content
text blocks; this does not change the response envelope or increase max_tokens.
Thinking and output configuration are passed through without SDK model-specific
enum or combination checks. The selected model determines which values it accepts.
For the beta display: "updates" mode, set the required header on a dedicated
client (client headers apply to every request):
with AceDataCloud(
api_token="your-token",
headers={"anthropic-beta": "thinking-display-updates-2026-08-18"},
) as client:
response = client.chat.messages.create(
model="claude-sonnet-5-5",
messages=[{"role": "user", "content": "Explain this code."}],
thinking={"type": "adaptive", "display": "updates"},
output_config={"effort": "high"},
)
AsyncAceDataCloud accepts the same header and fields. Streaming and
client.chat.messages.count_tokens(...) also preserve thinking configuration.
Parameter pass-through does not guarantee model support; API errors are returned
through the SDK's normal error handling.
Claude Fable 5.2
Use the exact model ID claude-fable-5-2. Native Messages preserves thinking and
tool content blocks. Omit temperature, top_p and top_k; adaptive thinking is
always enabled, and the output budget covers thinking plus the final answer.
For tools, use tool_choice={"type": "auto"}, not any or a forced tool.
Fable 5.1 and Fable 5 remain separate model IDs; upgrade by changing model explicitly.
Count Tokens and Responses are not published for this model. Consult the
current model page
for account availability and package-dependent prices; model discovery alone does
not guarantee a successful generation.
with AceDataCloud(api_token="your-token", base_url="https://api.acedata.cloud") as client:
response = client.chat.messages.create(
model="claude-fable-5-2",
messages=[{"role": "user", "content": "Explain this code."}],
max_tokens=4096,
output_config={"effort": "high"},
)
The asynchronous client accepts the same model and fields.
OpenAI Embeddings
result = client.openai.embeddings.create(
model="text-embedding-3-small",
input="The food was delicious and the waiter...",
)
Supported models are text-embedding-3-small and text-embedding-3-large.
text-embedding-ada-002 is no longer available. When migrating an existing index,
regenerate its vectors and rebuild the index; do not mix old and new model vectors.
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")
Nano Banana 2.1
Use aspect_ratio="auto" to let Nano Banana select the aspect ratio; explicit
ratios remain supported.
Select model="nano-banana-2.1" explicitly for generation or editing at
1K, 2K, or 4K. Omitting model still uses nano-banana; there is no
nano-banana-2.1:official variant.
task = client.nano_banana.generate(
action="generate",
model="nano-banana-2.1",
prompt="A blue ceramic vase on a cream background",
resolution="2K",
aspect_ratio="1:1",
)
task.wait()
image_urls = task.urls()
edit_task = client.nano_banana.generate(
action="edit",
model="nano-banana-2.1",
prompt="Change the vase to green; preserve the background",
image_urls=image_urls,
resolution="4K",
)
edit_task.wait()
AsyncAceDataCloud exposes the same parameters (await generate and wait).
The public model ID also works with client.openai.images.generate(...) and
client.openai.images.edit(...); those use the OpenAI-compatible fields
(image for editing) and return response dictionaries, not task handles.
GPT Image 2.5 / 2.6 quality
client.openai.images.generate(...) and .edit(...) pass quality through
unchanged. GPT Image models accept auto, low, medium, and high;
2.5 and 2.6 Flare/Sunburst models (including :reverse and :official
variants) additionally accept xhigh and max.
For both methods, :reverse is an explicit alias of the corresponding
unsuffixed Flare/Sunburst model. Pass the complete model ID unchanged, such as
gpt-image-2.6-flare or gpt-image-2.6-sunburst:reverse; do not use the
incomplete gpt-image-2.6. The SDK does not select a fallback.
The server may use GPT Image 2.5 Flare during automatic recovery for 2.0 / 2.5
reverse models, while preserving the requested model and per-successful-image
billing; 2.6 does not configure cross-model substitution.
gpt-image-2, both 2.5 models, and their :reverse aliases have a base price
of 0.19 Credits per successful image. The 2.6 Flare/Sunburst models and their
:reverse aliases have a base price of 0.22 Credits per successful image.
Official-channel requests are billed by actual token usage, not a fixed fee per
image; 2.6 uses the same official rates as 2.5. Check current account pricing and
usage records for final charges.
Both 2.6 models use the existing raster parameters: output_format is png,
jpeg, or webp (plus GIF for GPT Image 2.6; SVG is not supported), and size is auto or WIDTHxHEIGHT.
Explicit dimensions must be multiples of 16, with a longest side of at most
3840, 655,360–8,294,400 total pixels, and an aspect ratio of at most 3:1.
Editing uses image URLs through the SDK's JSON interface; Backend multipart
file upload support is not exposed by these helpers.
Maestro Video Production
Use the provider client to request one finished video in one language:
task = client.maestro.generate(
prompt="Explain vector databases to beginners in 20 seconds",
langs=["en"],
aspect="9:16",
duration=20,
scenario="narrated",
)
result = task.wait()
langs defaults to ["zh-cn"] and must contain exactly one language; create
separate tasks for other languages. The completed result contains one video in
response.data.variants. AsyncAceDataCloud supports the same parameters;
await both generate and wait. To revise a video, use action="remix",
"edit", or "extend" with ref_task_id=task.id.