Repository navigation
Releases
Releases · deapi-ai/deapi-python-sdk
deapi-sdk 0.7.0
Added
client.transcription.transcribe_sync()(sync and async clients): fast transcription for short
audio clips (voice notes, commands; usecreate()for longer audio). The transcript comes back
in the response as the new
SyncTranscriptionResult(transcription,language,duration,price, optionalsegments
withwords); there is no job to poll.transcribe_sync_price()quotes it from the file or from
duration_seconds. The model defaults toFluidSpeechPro. Clip limits are set by the API: a
422 onsource_file(e.g. a clip that is too long) stays aValidationErrorwith the API's
message, followed by a pointer tocreate().SyncTranscriptionUnavailableError: synchronous transcription is in limited availability;
accounts without access get a 404 or a 422 onmodel, raised as this error. It is also a
NotFoundErroror aValidationError, 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 aChatCompletionin the
OpenAI shape with deAPI's extras:usage.cost, theX-DeAPI-Costheader (header_cost),
reasoning_contentandreasoning_details. Any other Chat Completions parameter is passed
through; a message returned by the SDK can be appended tomessagesas is.stream=Truereturns aChatCompletionStream/AsyncChatCompletionStreamof
ChatCompletionChunks. Unlessstream_optionsis given, the SDK sends
{"include_usage": True}, so the stream'susageandcostcome from the final chunk.reasoning_effortis typed asReasoningEffort("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,pricingwith per-1M-token helpers).
oai_base_urlclient option andDEAPI_OAI_BASE_URLenvironment variable.- Errors in the OpenAI shape (
{"error": {...}}) map to the SDK's exceptions; a 400 is a
ValidationErrorand a 429insufficient_quotaanInsufficientBalanceError(not retried). - Example
examples/chat.py. client.web.search()andclient.web.contents()(sync and async clients), withsearch_price()
andcontents_price(): web search and page contents returned in the response asWebResults
(request_id,cost,resultsofWebPage). Web search and contents are in limited availability; accounts without access get a 404,
raised asWebSearchUnavailableError(aNotFoundError). Like other POSTs, a web call is
retried after a 429 and never resent after a timeout or a 5xx.ModelRetiredError(HTTP 410model_retired): a request named a retired model. Keeps the API's
message and exposesretired_atandreplacement. Any other 410 stays aDeapiError.JobResult.price_amountandJobResult.price_is_estimated: the charge of a job, read fromprice.
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.failedis sent, so itsrefundedreports it; the
docs andWebhookEventDatadocstring say so.
Fixed
client.realtime()works again where the API does not provide realtime settings: when
GET /websocketanswers 404,connect()uses the built-in production WebSocket server and public
app key for whatever is missing (productionbase_urlonly), so only the Client ID is needed
(client_idorDEAPI_CLIENT_ID). Without it, or for anotherbase_urlwithoutws_url/
app_key,connect()raisesRealtimeErrornaming what to set (status_code404). Other HTTP
errors from discovery are raised as before; explicit, environment and discovered settings still
win. 0.6.0 and 0.6.1 neededws_urlandapp_keyset by hand in that case.
deapi-sdk 0.6.1
Added
- Published on PyPI:
pip install deapi-sdk(pip install "deapi-sdk[ws]"for real-time status).
Releases are uploaded by GitHub Actions when a GitHub Release is published.
Changed
- README links are absolute, so they also work on the PyPI project page.
- The product name is spelled deAPI throughout the docs and docstrings.
Install: pip install deapi-sdk (or pip install "deapi-sdk[ws]" for real-time status).
deapi-sdk 0.6.0
Added
client.websocket_config()(sync and async) returns the account's realtime connection settings
(GET /websocket) as the newWebSocketConfig/WebSocketConnectionmodels. Works with any API key.
Changed
client.realtime()no longer needs any settings.client_id,ws_urlandapp_keyare each taken
from the argument, thenDEAPI_CLIENT_ID/DEAPI_WS_URL/DEAPI_WS_APP_KEY, thenGET /websocket.
The discovery call is made once at connect time and only when something is still missing; with all
three set, no extra request is made.- Setting only
DEAPI_CLIENT_IDnow triggers oneGET /websocketcall at connect time instead of
falling back to built-in WebSocket defaults. The hard-coded WebSocket URL and app key were removed. Realtime.client_id/AsyncRealtime.client_idis nowstr | None:Noneuntil connect when it was
neither passed nor set in the environment.- An unusable discovery response raises
RealtimeError; HTTP errors from it raise the usual API exceptions.
Install: pip install "deapi-sdk[ws] @ git+https://github.com/deapi-ai/deapi-python-sdk.git@v0.6.0"