Skip to main content

Unofficial Python client for SeaArt.ai API

Project description

🌀 SeaArt Python SDK

PyPI version Python 3.11+ License: MIT

Unofficial typed Python client for the SeaArt.ai API with sync and async support.

Installation

pip install seaart

Quick Start

Authentication

from seaart import SyncClient

with SyncClient() as client:
    client.auth.login(email="user@example.com", password="password")
from seaart import AsyncClient

async with AsyncClient() as client:
    await client.auth.login(email="user@example.com", password="password")

No account? Use tourist mode for quick access:

client.auth.login_as_tourist()

Character Chat

from seaart import SyncClient
from seaart.helpers import extract_character_link
from seaart.types import AppId

link = extract_character_link("https://www.seaart.ai/character/chat/...")
with SyncClient(app_id=AppId.APP) as client:
    client.auth.login(email="user@example.com", password="password")

    chat = client.characters.chats.create(link.character_id)
    result = client.characters.chats.send("Hello!", chat.value.session_id)
    print(result.text)
from seaart import AsyncClient
from seaart.helpers import extract_character_link
from seaart.types import AppId

link = extract_character_link("https://www.seaart.ai/character/chat/...")
async with AsyncClient(app_id=AppId.APP) as client:
    await client.auth.login(email="user@example.com", password="password")

    chat = await client.characters.chats.create(link.character_id)
    result = await client.characters.chats.send("Hello!", chat.value.session_id)
    print(result.text)

Image Generation

from seaart import SyncClient
from seaart.helpers import extract_model_link

model = extract_model_link("https://www.seaart.ai/create/image?id=...&model_ver_no=...")
with SyncClient() as client:
    client.auth.login(email="user@example.com", password="password")

    envelope = client.images.text_to_img(
        prompt="a serene mountain landscape at sunset, oil painting",
        model_no=model.model_no,
    )
    item = envelope.wait(timeout=120)
    print(item.image_url)
from seaart import AsyncClient
from seaart.helpers import extract_model_link

model = extract_model_link("https://www.seaart.ai/create/image?id=...&model_ver_no=...")
async with AsyncClient() as client:
    await client.auth.login(email="user@example.com", password="password")

    envelope = await client.images.text_to_img(
        prompt="a serene mountain landscape at sunset, oil painting",
        model_no=model.model_no,
    )
    item = await envelope.wait(timeout=120)
    print(item.image_url)

Features

  • Sync and async clients with identical APIs
  • Typed Pydantic v2 response models
  • SSE streaming for character chat
  • Task polling with envelope.wait()
  • Built on curl-cffi (HTTP/2, HTTP/3, browser impersonation)
  • Structured exception hierarchy

Requirements

Python 3.11 or higher.

Examples

File Description
quickstart.py Minimal working examples for chat and image generation
auth.py All authentication methods
characters_chat.py Chat, history, settings, voice audio
characters_stream.py SSE streaming for character responses
image_generation.py Text-to-image, img-to-img, upscaling, background removal
search.py Search characters, models, works with pagination
gen_agent.py GenAgent streaming and image attachments
async_usage.py Concurrent generation and streaming with AsyncClient
custom_requests.py Low-level request() and request_stream() for uncovered endpoints

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

seaart-0.1.0.tar.gz (194.6 kB view details)

Uploaded Source

Built Distribution

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

seaart-0.1.0-py3-none-any.whl (153.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for seaart-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f481f430c2db0e306eb7e13e7a62c1f5ab0684a97eab52aee9c9b59561ea706b
MD5 2f37ffacbae4bcf8097c8e3e5b57199f
BLAKE2b-256 3c96535cddea1a78032f41fe68a1bb423a58c6275621d8364f5dd638705de614

See more details on using hashes here.

File details

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

File metadata

  • Download URL: seaart-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 153.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for seaart-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 821b13c73efe0fc4c391f6d9eea4e08d0a132493cbc7d2d391f7ca73c7038b77
MD5 1f36120d1bff50f9557aaa9545f39213
BLAKE2b-256 4e2a598838f9000ec9dc188a35f6ae465cc58a686b59456b7d88056ea0047842

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