Skip to content

Releases

deapi-sdk 0.7.0

Choose a tag to compare

@dawidope dawidope released this 30 Nov 19:57
05c8a29

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
      ChatCompletionChunks. 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.

deapi-sdk 0.6.1

Choose a tag to compare

@dawidope dawidope released this 19 Nov 12:33
c0ef87c

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

Choose a tag to compare

@dawidope dawidope released this 19 Nov 10:22
b5ab4ae

Added

  • client.websocket_config() (sync and async) returns the account's realtime connection settings
    (GET /websocket) as the new WebSocketConfig / WebSocketConnection models. Works with any API key.

Changed

  • client.realtime() no longer needs any settings. client_id, ws_url and app_key are each taken
    from the argument, then DEAPI_CLIENT_ID / DEAPI_WS_URL / DEAPI_WS_APP_KEY, then GET /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_ID now triggers one GET /websocket call 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_id is now str | None: None until 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"