Skip to main content

Python SDK

Official Python SDK for Shim. One dependency (httpx). Sync and async clients included.

Installation

pip
poetry
uv

Quick Start


Client Configuration

Sync

Async

Parameters:
  • api_key (str, required): Your Shim API key
  • base_url (str, optional): API base URL. Default: https://api.shim.so

Batch Repair

Sync

Async

With Schema Validation


Streaming Repair

stream.start()

Start a new streaming session. Schema and mode are set here — not on push.

stream.push()

Push a chunk. Returns the current streaming state.

stream.finalize()

Close the session. Returns the full repair response.

Complete Streaming Example

Sync

Async


Type Hints

The SDK ships with full type definitions. All response objects are dataclasses.
Exported types:

Error Handling

The SDK raises httpx.HTTPStatusError for transport-level failures. Shim itself always returns HTTP 200 — application errors are in the response body.

Next Steps

Batch Endpoint

API reference for batch repair

Streaming Endpoints

API reference for streaming repair

Response Object

Full response schema

TypeScript SDK

Node.js / browser SDK