Skip to main content

medisync

The Python SDK for the MediSync API: speech to text (batch and live), clinical notes and letters, ICD-10-GM coding, decisions, account reads and MediSync Connect.

Everything the API generates is a draft. A clinician reviews and releases it.

  • Python 3.9 or later. A sync client MediSync and an asyncio client AsyncMediSync.
  • Typed: pydantic v2 models, py.typed, checked with mypy (strict) and pyright (strict).
  • API reference: https://docs.medisync.me

Install

pip install medisync
# MediSync Connect apps that sign with a key pair:
pip install "medisync[app]"

Start

from medisync import MediSync

client = MediSync()  # reads MEDISYNC_API_KEY

models = client.models.list()
codes = client.coding.icd10gm(mentions=[{"id": "m1", "text": "Vorhofflimmern, paroxysmal"}])
import asyncio
from medisync import AsyncMediSync


async def main() -> None:
    async with AsyncMediSync() as client:
        models = await client.models.list()


asyncio.run(main())

Every method is named after its API operation, in snake_case: client.connect.transfers.create(...), client.decisions.create_batch(...). Body and query fields are keyword arguments. A field you leave out is not sent; None sends null.

Options

client = MediSync(
    api_key="msk_test_…",                 # default: MEDISYNC_API_KEY
    base_url="https://api.medisync.me",   # default: MEDISYNC_BASE_URL, else this
    version="2026-11-01",                 # the MediSync-Version header; default: the version of this SDK
    timeout=120.0,                        # seconds per attempt
    max_retries=2,
    on_response=lambda info: print(info.operation, info.status, info.request_id),
)

Every method also takes extra_headers, extra_query, timeout, and, where the operation takes one, idempotency_key and extra_body.

Retries and idempotency

The client retries network errors, 408, 409 idempotency_key_in_use, 429 and 5xx (not 501). It waits for retry-after when the answer has one, else it backs off with jitter. It does not retry spend_cap_reached or test_daily_limit_reached.

It retries only GET requests and requests with an Idempotency-Key. Every POST that takes a key gets a UUID, and each retry sends the same key. A file upload is read again from its start for each attempt.

Errors

Every answer outside 2xx raises an APIError subclass with status, code, type, param, request_id and the error object of the body. The classes are the same as in the TypeScript SDK: InvalidRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, RateLimitError, TargetError (the PVS or KIS refused), ServiceUnavailableError, GatewayTimeoutError, the MediSync Connect classes (NotSupportedError, VerbNotGrantedError, LicenceRequiredError, AlreadyTransferredError, and others), and APIConnectionError and APITimeoutError when no answer came.

from medisync import NotSupportedError

try:
    client.connect.diagnoses.plan_write(connection_id, patient=patient, diagnoses=diagnoses, source={"app": "beispiel-scribe"})
except NotSupportedError as err:
    print(err.reason, err.alternative)

Batch transcription

from pathlib import Path

created = client.audio.transcriptions.create(file=Path("visit.wav"), language="de", diarization=True)
done = client.audio.transcriptions.wait(created.id)
if done.status == "completed" and done.result:
    print(done.result.text)

file takes a path, bytes, an open binary file, or a tuple (filename, content, content_type).

Live transcription

async with client.audio.stream.open(config={"language": "de"}) as stream:
    async def read() -> None:
        async for event in stream:
            if event.type == "transcript":
                print(event.segment.start, event.text)

    reader = asyncio.create_task(read())
    async for frame in microphone():  # 16 kHz mono pcm_s16le
        await stream.send(frame)
    await stream.finish()  # end_utterance, the last transcripts, then close
    await reader

The sync client has the same stream; a thread reads the socket. On a drop, or a fatal error a new stream can continue (worker_lost, max_duration_reached and others), the stream connects again from the last segment.end and sends the audio after that point again. You see a reconnecting event. This works for pcm_s16le.

MediSync Connect

Lists answer a page. Iterate the page to read every page:

for site in client.connect.sites.list():
    print(site.id)

A write is planned, shown to the doctor, released, then transferred:

from medisync.connect import build_release

plan = client.connect.records.plan_write(connection_id, document=document, mapping_id=mapping_id, mapping_version=1)
# Show plan.preview to the doctor. Continue only after the doctor released it.
release = build_release(plan, member_id=member_id, role="doctor", practitioner_link="ARZT-03", patient_confirmed=document["patient"])
transfer = client.connect.transfers.create(plan_id=plan.id, release=release)
done = client.connect.transfers.wait(transfer.id)

Helpers that are no API operation: connect.transfers.wait, connect.events.poll (pass a threading.Event or asyncio.Event as stop), connect.capabilities.for_connection and audio.transcriptions.wait.

Apps with a key pair (private_key_jwt):

from medisync import AppCredentials, MediSync

client = MediSync(connect_app=AppCredentials(client_id="app_6Tn3Cw9KhZ", key_id="k1", private_key=pem, installation_id="ins_3Rv8Qa2MxK"))

Models: medisync.types for the platform API and the live stream, medisync.types.connect for MediSync Connect.

Licence

Apache-2.0

Metadata

Release files for medisync 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for medisync 0.1.0
File Size Uploaded Provenance Actions
medisync-0.1.0.tar.gz 96.5 kB With provenance Details for medisync-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for medisync 0.1.0
File Interpreter ABI Platform Actions
medisync-0.1.0-py3-none-any.whl Python 3 none any Details for medisync-0.1.0-py3-none-any.whl

Total release size: 203.0 kB

Release files / medisync-0.1.0.tar.gz

Download URL medisync-0.1.0.tar.gz
Size 96.5 kB
Tags Source
SHA-256 checksum
How to use checksums
770557d25db4b8caffa8251acbb1e96089445685ee52eccd493c8f5d244dae4a
BLAKE2b-256 checksum
How to use checksums
328f1673221dd2009416abb20ce6b189f89a8014718aa9de748893d4012a0195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / medisync-0.1.0-py3-none-any.whl

Download URL medisync-0.1.0-py3-none-any.whl
Size 106.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39a8a73adaed543e1e9641323d6d2f8ec51055f8cc34621024d3411f84e02003
BLAKE2b-256 checksum
How to use checksums
b9eb84ea35003303062785391a14c9bbe99f30b3b2eeb20f9c88bfaf803e8b69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for medisync 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for medisync-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page