Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ DEAPI_API_KEY=sk-dp-<id>-<secret>

# Optional overrides
# DEAPI_BASE_URL=https://api.deapi.ai
# OpenAI-compatible API used by client.chat
# DEAPI_OAI_BASE_URL=https://oai.deapi.ai/v1
# DEAPI_API_VERSION=v2 # only "v2" is accepted
# Set to 0 to stop the SDK filling unset parameters from the model card defaults
# DEAPI_FILL_MODEL_DEFAULTS=1

# Real-time status over WebSocket (pip install "deapi-sdk[ws]")
# All optional: anything unset is fetched from the API (GET /websocket) when the connection opens.
# Anything unset is fetched from the API (GET /websocket) when the connection opens. Where the API
# does not provide it (404), the production server is used and only the Client ID is required.
# The "Client ID" shown in your dashboard; pass client_id= explicitly when serving many users
# DEAPI_CLIENT_ID=your-client-id
# Overrides, e.g. for a local WebSocket server
Expand Down
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,64 @@
All notable changes to this project are documented in this file.
Versions follow [Semantic Versioning](https://semver.org/) (pre-1.0: minor versions may contain breaking changes).

## [0.7.0] - 2026-11-30

### Added

- `client.transcription.transcribe_sync()` (sync and async clients): fast transcription for short
audio clips (voice notes, commands; use `create()` for longer audio). The transcript comes back
in the response as the new
`SyncTranscriptionResult` (`transcription`, `language`, `duration`, `price`, optional `segments`
with `words`); there is no job to poll. `transcribe_sync_price()` quotes it from the file or from
`duration_seconds`. The model defaults to `FluidSpeechPro`. Clip limits are set by the API: a
422 on `source_file` (e.g. a clip that is too long) stays a `ValidationError` with the API's
message, followed by a pointer to `create()`.
- `SyncTranscriptionUnavailableError`: synchronous transcription is in limited availability;
accounts without access get a 404 or a 422 on `model`, raised as this error. It is also a
`NotFoundError` or a `ValidationError`, so existing handlers keep catching it.
- Example `examples/transcription_sync.py`.
- `client.chat`: LLM chat through deAPI's OpenAI-compatible API (`https://oai.deapi.ai/v1`, same API
key), on the sync and async clients.
- `chat.completions.create(model=..., messages=[...], **params)` returns a `ChatCompletion` in the
OpenAI shape with deAPI's extras: `usage.cost`, the `X-DeAPI-Cost` header (`header_cost`),
`reasoning_content` and `reasoning_details`. Any other Chat Completions parameter is passed
through; a message returned by the SDK can be appended to `messages` as is.
- `stream=True` returns a `ChatCompletionStream` / `AsyncChatCompletionStream` of
`ChatCompletionChunk`s. Unless `stream_options` is given, the SDK sends
`{"include_usage": True}`, so the stream's `usage` and `cost` come from the final chunk.
- `reasoning_effort` is typed as `ReasoningEffort` (`"none"` ... `"max"`), other strings allowed.
- Chat requests are sent once and never retried automatically (every accepted request is billed).
- `chat.models()` lists the chat models (`ChatModel`: context length, output limit, supported
parameters, `pricing` with per-1M-token helpers).
- `oai_base_url` client option and `DEAPI_OAI_BASE_URL` environment variable.
- Errors in the OpenAI shape (`{"error": {...}}`) map to the SDK's exceptions; a 400 is a
`ValidationError` and a 429 `insufficient_quota` an `InsufficientBalanceError` (not retried).
- Example `examples/chat.py`.
- `client.web.search()` and `client.web.contents()` (sync and async clients), with `search_price()`
and `contents_price()`: web search and page contents returned in the response as `WebResults`
(`request_id`, `cost`, `results` of `WebPage`). Web search and contents are in limited availability; accounts without access get a 404,
raised as `WebSearchUnavailableError` (a `NotFoundError`). Like other POSTs, a web call is
retried after a 429 and never resent after a timeout or a 5xx.
- `ModelRetiredError` (HTTP 410 `model_retired`): a request named a retired model. Keeps the API's
message and exposes `retired_at` and `replacement`. Any other 410 stays a `DeapiError`.
- `JobResult.price_amount` and `JobResult.price_is_estimated`: the charge of a job, read from `price`.

### Changed

- Text-to-music is billed by the length actually generated: `compose_price()` is documented as a
quote for the requested duration; the finished job carries the final charge.
- Webhooks: a refund is now booked before `job.failed` is sent, so its `refunded` reports it; the
docs and `WebhookEventData` docstring say so.
### Fixed

- `client.realtime()` works again where the API does not provide realtime settings: when
`GET /websocket` answers 404, `connect()` uses the built-in production WebSocket server and public
app key for whatever is missing (production `base_url` only), so only the Client ID is needed
(`client_id` or `DEAPI_CLIENT_ID`). Without it, or for another `base_url` without `ws_url` /
`app_key`, `connect()` raises `RealtimeError` naming what to set (`status_code` 404). Other HTTP
errors from discovery are raised as before; explicit, environment and discovered settings still
win. 0.6.0 and 0.6.1 needed `ws_url` and `app_key` set by hand in that case.

## [0.6.1] - 2026-11-19

### Added
Expand Down
Loading