Repository navigation
Release 0.7.0: fast transcription, chat, web search, prod compatibility - #17
Merged
Merged
Conversation
client.transcription.transcribe_sync() (sync and async clients) uploads a short audio file (up to 60 s) to POST /audio/transcriptions/sync and returns the transcript from the response as SyncTranscriptionResult: transcription, detected language, duration, price and, with timestamps, segments with optional words. There is no job to poll. The model defaults to FluidSpeechPro; ts_level implies include_ts, as in create(). transcribe_sync_price() quotes it from the file or from duration_seconds, always as multipart. Synchronous transcription is in limited availability. A 404, or a 422 on model, is raised as SyncTranscriptionUnavailableError, which is also a NotFoundError or a ValidationError so existing handlers keep catching it. Other errors (a clip over 60 s, balance, rate limit) are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WhisperLargeV3 is retired. The examples' file-upload and price calls now use WhisperLargeV3Ct2, the plain-text demo in examples/transcription.py is dropped, and the docs describe plain-text models without naming the retired one. Tests that use the name only as an arbitrary model string are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Docstrings, README, API reference, CHANGELOG and the example now open with the limit: up to 60 s and 16 MiB per file, for voice notes, commands and short clips, with create() for anything longer. Limits are checked locally where it is cheap: a source_file over 16 MiB, or a quote for duration_seconds over 60, raises ValueError before anything is sent. A 422 on source_file (e.g. a clip over 60 s) stays a ValidationError with the API's errors and body, and its message now also points to create(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The limits can change on the API side, so the SDK no longer hardcodes them: the local 16 MiB and 60 s checks, their constants and the numbers in docstrings, the hint text and the example are gone. A 422 on source_file still passes the API's message (which states the current limit) through and adds a pointer to create() for longer audio. The README and API reference describe it as fast transcription for short audio clips, "currently up to 60 seconds", with a link to the deAPI docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /websocket answers 404 where the API does not provide realtime settings, and since 0.6.0 connect() then failed with NotFoundError unless ws_url and app_key were set by hand. On a 404, connect() now fills the missing ws_url / app_key with the built-in production WebSocket server and its public app key (only for the production base_url), 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 the settings to pass (status_code 404, the NotFoundError as its cause) and does not connect. Other HTTP errors from discovery propagate as before; explicit, environment and discovered settings still win. Tests cover the fallback with the fake Pusher server (sync and async), the missing Client ID, a non-production base_url, discovered settings winning and other HTTP errors. README, API reference, .env.example, the realtime example and CHANGELOG (Unreleased, Fixed) are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nanonets_Ocr_S_F16, AceStep_1_5_Turbo and WhisperLargeV3 are no longer in the model catalogue. The README OCR example and the OCR tests now use LightOnOcr_3_4B_Q8, the music tests AceStep_1_5_XL_Turbo_INT8 and the transcription payload test WhisperLargeV3Ct2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
client.chat.completions.create(model=..., messages=[...], **params) posts to /chat/completions on oai_base_url (default https://oai.deapi.ai/v1, env DEAPI_OAI_BASE_URL) with the same API key, on the sync and async clients. It 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. Other Chat Completions parameters pass through; a message returned by the SDK can be appended to messages as is, so reasoning_details go back in the next turn. stream=True returns a ChatCompletionStream (AsyncChatCompletionStream) of ChatCompletionChunk parsed from SSE; the final usage chunk sets usage and cost. Errors are raised before the first chunk; an error event inside the stream raises DeapiError. client.chat.models() lists the /models entries that have pricing, as ChatModel with per-1M-token price helpers. The HTTP clients gain request_response() (to read headers), open_stream() and a per-request timeout, all on the existing retry policy: a POST is never resent after a timeout or a 5xx. OpenAI-shaped error bodies map to the existing exceptions; a 400 is a ValidationError and an out-of-credit error (insufficient_quota / insufficient_balance) an InsufficientBalanceError that is not retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OpenAI-compatible API bills every chat request it accepts and does
not honour an Idempotency-Key, so chat completions (streamed or not) are
now sent exactly once: no automatic retry after a 429 or a connection
error either. The HTTP clients' request_response() and open_stream() take
retry=False for this; chat.models() is a GET and keeps the usual policy.
reasoning_effort is an explicit parameter typed as ReasoningEffort
("none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"), with
other strings still accepted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With stream=True and no stream_options, chat.completions.create() now
sends stream_options={"include_usage": true}, so a stream's usage and
cost are available without extra arguments. An explicit stream_options
(e.g. {"include_usage": false}) is sent as given.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- client.web.search() / contents() (sync and async) with search_price() and contents_price(): synchronous calls whose results come back in the response as WebResults (request_id, cost, results of WebPage). Text, excerpts and summary options take True, a max_length / query, or the API's object; for search they are sent as "include". Web search is in limited availability: a 404 is raised as WebSearchUnavailableError (a NotFoundError). Like other POSTs, a web call is retried after a 429 (a refused call is not charged) and never resent after a timeout or a 5xx. - A 410 whose code is model_retired (or whose body has retired_at) raises ModelRetiredError with the API's message, retired_at and replacement; any other 410 stays a DeapiError. Not retried. - JobResult.price_amount / price_is_estimated read the job's charge from price. Text-to-music is billed by the length actually generated, so compose_price() is documented as a quote for the requested duration. - Webhooks: a refund is booked before job.failed is sent, so refunded reports it; docs and the WebhookEventData docstring say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The API adds "reason" (e.g. "fetch_failed") to some web contents results with status "unknown"; it is now a typed field instead of an extra. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release 0.7.0. It adds fast transcription, chat (LLMs), web search, compatibility with the current production API, and realtime that works out of the box.
Fast transcription of short audio clips
client.transcription.transcribe_sync()(sync and async clients) handles voice notes, commands and short clips. The transcript comes back in the same HTTP response, with no job, polling or webhook.SyncTranscriptionResult:transcription, the detectedlanguage,duration, the chargedpriceand, on request,segments(withwordsatts_level="word").transcribe_sync_price()quotes it from the file or fromduration_seconds.FluidSpeechPro.create().model, raised asSyncTranscriptionUnavailableError. It is also aNotFoundError/ValidationError, so existing handlers keep working.examples/transcription_sync.py.Chat (LLMs)
client.chatworks on the sync and async clients, through deAPI's OpenAI-compatible API (https://oai.deapi.ai/v1) with the same API key.chat.completions.create(model=..., messages=[...], **params)returns a typedChatCompletionin the OpenAI shape. deAPI's extras are included:usage.cost, theX-DeAPI-Costheader,reasoning_contentandreasoning_details. A returned message can be appended tomessagesas is.stream=Truereturns a chunk iterator. The SDK asks for the final usage chunk by default, sousageandcostare available.reasoning_effortis typed ("none"…"max").chat.models()lists the chat models with limits, supported parameters and prices.oai_base_urloption /DEAPI_OAI_BASE_URLsets the API address.examples/chat.py.Web search and page contents
client.web.search()andclient.web.contents(), plus free quotessearch_price()andcontents_price(). Results come back in the response.statusandWebPage.reason(for examplefetch_failed), and is not charged.WebSearchUnavailableError, which is aNotFoundError.Current production API
ModelRetiredError(HTTP 410model_retired), withretired_atandreplacement. The docs and examples use current models only.JobResult.price_amountandprice_is_estimatedgive the charge of a finished job. Music is billed by the length actually generated, socompose_price()is documented as a quote.job.failedis sent.Fixed: realtime without manual settings
client.realtime()reads its connection settings fromGET /websocket. Where that answers 404,connect()failed unlessws_urlandapp_keywere set by hand.ws_url/app_keyis filled with the production WebSocket server and its public app key. Only the Client ID is needed.RealtimeErrornames what to pass.Breaking changes
A 410 with
code: "model_retired"used to be a plainDeapiError. It is nowModelRetiredError, a subclass, soexcept DeapiErrorstill catches it. Everything else is additive.Checks
ruff check src tests examplespasses.mypy src tests/fake_pusher.py tests/test_request_files.pypasses.pytest -m "not integration": 796 passed on Python 3.11 and 3.13, in Docker.transcribe_sync()(transcript, language, price);Version 0.7.0 is set in
pyproject.toml,_version.pyand the CHANGELOG. After merging, publish a GitHub Releasev0.7.0to upload to PyPI (thepypienvironment waits for approval).🤖 Generated with Claude Code