Skip to main content

fastSDK. Any service. One typed client.

PyPI version Python versions GitHub License

Call any AI / web service like a native Python function

fastSDK turns any hosted service (OpenAPI/FastAPI, APIPod, RunPod, Replicate, Cog) into a Python client: connect, submit_job, file upload/download, job handling and parallel execution.

Point it at a service. Call it like a function. That's the whole idea.

import fastsdk

client = fastsdk.connect("http://localhost:8009")
job = client.submit_job("/text2voice", text="hello world")
audio = job.get_result()
audio.save("hello.mp3")

Why fastSDK?

Calling a web service from Python sounds trivial until you actually do it in production: you wait synchronously on long-running ML jobs, you hand-write request code for every endpoint, you fight with file uploads (try sending a 1 GB video through requests), you poll job status loops, and you reinvent threading to run requests in parallel.

fastSDK solves exactly that, and nothing else:

  • One call = one job. Every call returns a job object immediately. Get the result when you need it, run hundreds of jobs in parallel meanwhile.
  • Files just work. Images, audio, video are handled by media-toolkit — local paths, URLs, bytes or numpy arrays in; media objects out. Large files are uploaded via cloud storage (S3, Azure) when configured.
  • Job-based providers are normalized. Replicate, RunPod serverless, APIPod and Socaity all expose "submit, then poll" APIs with different wire formats. fastSDK handles submission, polling, progress and cancellation uniformly.
  • One client class. connect() loads the spec and returns a FastClient. Call any endpoint with submit_job(path, **params).

Installation

pip install fastsdk           # core
pip install fastsdk[replicate]  # + Replicate model support

Get started

connect() loads a URL, an openapi.json path, or a Replicate model reference. No files written.

import fastsdk

client = fastsdk.connect("http://localhost:8009")
job = client.submit_job("/text2voice", text="hello world")
result = job.get_result()

Replicate models

Official models (called via /v1/models/{owner}/{name}/predictions) and community models (called via /v1/predictions with a version) resolve automatically. Name the model:

import fastsdk  # requires: pip install fastsdk[replicate] and REPLICATE_API_KEY

client = fastsdk.connect("replicate:black-forest-labs/flux-schnell")
job = client.submit_job("/predictions", prompt="a t-rex on a skateboard")
image = job.get_result()

Working with jobs

job = client.submit_job("/swap-img-to-img", source_img="face1.jpg", target_img="face2.jpg")
job.get_result()          # block until done and return the result
job.cancel()              # cancel locally and remotely (provider permitting)

jobs = [client.submit_job("/text2voice", text=t) for t in hundred_texts]
results = fastsdk.gather_results(jobs)

API keys

Pass api_key=... to connect() or the client constructor, or set REPLICATE_API_KEY, RUNPOD_API_KEY, SOCAITY_API_KEY, or <SERVICE_ID>_API_KEY.

The three concepts

Concept What it is
Service An Service (from socaity-schemas) with one ServiceDetails binding: provider, execution, address, and the parsed ServiceContract. Get one with fastsdk.inspect_service(source).
Registry An in-process directory of services, shared by all clients. register_service() adds to it.
Client FastClient. connect() returns one. Call submit_job(path, **params).

CLI

fastsdk inspect http://localhost:8009
fastsdk call http://localhost:8009 /text2voice --text "hello world" -o hello.mp3
fastsdk registry add http://localhost:8009 --name speechcraft
fastsdk registry list
fastsdk call speechcraft /text2voice --text "hi again"

Service compatibility

Works out of the box with:

fastSDK + APIPod

APIPod builds and deploys the services; fastSDK consumes them. Two beating hearts 💕 for service ↔ client interaction.

Contribute

We at SocAIty want to provide the best tools to bring generative AI to the cloud. Report bugs, ideas and feature requests in the issues section. fastSDK is MIT-licensed and free to use. Leave a star to support us!


Made with ❤️ by SocAIty

Metadata

Release files for fastsdk 0.4.20

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

Source distribution (sdist)

Source distribution for fastsdk 0.4.20
File Size Uploaded
fastsdk-0.4.20.tar.gz 101.1 kB Details

Built distribution (wheel)

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

Total release size: 192.0 kB

Release files / fastsdk-0.4.20.tar.gz

Download URL fastsdk-0.4.20.tar.gz
Size 101.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5cc2d768274924633d24bb03703bdfeb87e79fe1935746bb542d17ab41b208ba
BLAKE2b-256 checksum
How to use checksums
7114a8a390e617d14b80c7ac9a90e100cfe2378300c542cade6e8e3163d4e14d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / fastsdk-0.4.20-py3-none-any.whl

Download URL fastsdk-0.4.20-py3-none-any.whl
Size 90.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
945abe60515fdc8ce4fbe1c8dc0ae7910a0677fcd46208dc8074fcc99aaca4ac
BLAKE2b-256 checksum
How to use checksums
591557aafd041c440437cb954caf4bf9233a3f9c1c33ec96ec802e42171b939b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.4.26

2 release files

0.4.25

2 release files

0.4.24

2 release files

This release

0.4.20 This release

2 release files

0.4.19

2 release files

0.4.18

2 release files

0.4.17

2 release files

0.4.15

2 release files

0.4.14

2 release files

0.4.13

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.3.1

2 release files

0.2.33

2 release files

0.2.32

2 release files

0.2.31

2 release files

0.2.30

2 release files

0.2.27

2 release files

0.2.26

2 release files

0.2.25

2 release files

0.2.24

2 release files

0.2.23

2 release files

0.2.22

2 release files

0.2.21

2 release files

0.2.20

2 release files

0.2.18

2 release files

0.2.16

2 release files

0.2.15

2 release files

0.2.14

2 release files

0.2.13

2 release files

0.2.11

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

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