Skip to main content

Python SDK

The official Python SDK for deAPI. Generate images, videos, audio, transcriptions, embeddings, and more — through a type-safe Python interface with sync and async support.

GitHub Repository

deapi-ai/deapi-python-sdk

Installation

Requirements: Python 3.9+

Quick Start

Features

  • Full API coverage — images, video, audio (TTS, voice cloning, music), transcription, embeddings, OCR, prompt enhancement
  • Sync + AsyncDeapiClient and AsyncDeapiClient
  • Job polling — automatic exponential backoff with .wait()
  • Auto-retry — built-in retry on rate limits (429) and server errors (5xx)
  • Type-safe — full type hints, Pydantic v2 models, py.typed marker
  • Webhook verification — HMAC-SHA256 signature validation
  • Price calculation — every method has a _price counterpart to check cost before submitting
For full documentation, configuration options, usage examples, and API reference, visit the GitHub repository.

OpenAI SDK (drop-in compatible)

deAPI also exposes an OpenAI-compatible endpoint at https://oai.deapi.ai/v1. If you’re already using the official OpenAI SDK in any language, you can route image generation, text-to-speech, transcription, embeddings, and video generation to deAPI by changing only base_url and api_key — your existing code stays unchanged. This works with Python, Node.js / TypeScript, Go, Java, .NET, and any framework that accepts a base_url parameter (LangChain, LlamaIndex, Vercel AI SDK).

OpenAI Compatibility — full guide

Migration examples, supported endpoints, framework integrations, and known differences

Coming Soon

We’re working on official SDKs for:
  • Node.js / TypeScript