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 that feels like a local library: typed methods, file upload/download, async job handling and parallel execution included.

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.
  • Codegen when you want it, not when you don't. Use connect() for instant access, or generate_stub() to get a typed .py client with one method per endpoint - autocomplete and docstrings included.

Installation

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

Get started

Option A: connect — use a service right now

No files, no codegen. Works with a URL, an openapi.json path, or a Replicate model reference.

import fastsdk

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

Option B: generate_stub — typed clients for real projects

Generates a .py file with one typed method per endpoint. This is your SDK.

import fastsdk

stub = fastsdk.generate_stub("http://localhost:8009", save_path="clients/")
print(stub.path, stub.class_name)

# use it immediately ...
client = stub.client()
job = client.text2voice(text="hello world")

# ... or import it in your next run like any other module
# from clients.speechcraft import speechcraft
# client = speechcraft()

Re-running generate_stub is safe: the file is overwritten and the service registration is updated, not duplicated.

Replicate models

Official models (called via /v1/models/{owner}/{name}/predictions) and community models (called via /v1/predictions with a version) are resolved automatically — you just name the model:

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

stub = fastsdk.generate_stub("replicate:black-forest-labs/flux-schnell", save_path="clients/")
flux = stub.client()
job = flux(prompt="a t-rex on a skateboard")
image = job.get_result()

Working with jobs

job = client.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)

# run many jobs in parallel - this is where fastSDK shines
jobs = [client.text2voice(text=t) for t in hundred_texts]
results = fastsdk.gather_results(jobs)

API keys

Pass api_key=... to connect(), generate_stub() or the client constructor — or set environment variables: REPLICATE_API_KEY, RUNPOD_API_KEY, SOCAITY_API_KEY, or <SERVICE_ID>_API_KEY for your own services.

The four concepts

Concept What it is
Service An AIService (from socaity-schemas) with one deployment: hosting provider, address, and the parsed ServiceContract (endpoints, parameters, whether responses are polled jobs). Get one with fastsdk.inspect_service(source), it has no side effects.
Registry An in-process directory of services, shared by all clients. register_service() adds to it; generated stubs look their service up in it by ID.
Client The runtime object you call (FastClient). It submits jobs to the service. connect() gives you a generic one instantly.
Stub A generated .py file containing a client subclass with one typed method per endpoint. Made by generate_stub(); it's plain code — read it, version it, ship it.

CLI

Everything above also works from the terminal — same verbs, same behavior:

# What can this service do?
fastsdk inspect http://localhost:8009

# Generate a typed client stub
fastsdk generate http://localhost:8009 -o clients/ --name SpeechCraft
fastsdk generate replicate:black-forest-labs/flux-schnell --api-key r8_...

# Call an endpoint without writing any code (curl for AI services)
fastsdk call http://localhost:8009 /text2voice --text "hello world" -o hello.mp3

# Keep services around by name (persisted in ~/.fastsdk/registry)
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 :two_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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastsdk-0.4.16.tar.gz (100.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastsdk-0.4.16-py3-none-any.whl (88.7 kB view details)

Uploaded Python 3

File details

Details for the file fastsdk-0.4.16.tar.gz.

File metadata

  • Download URL: fastsdk-0.4.16.tar.gz
  • Upload date:
  • Size: 100.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for fastsdk-0.4.16.tar.gz
Algorithm Hash digest
SHA256 eee5b4b32acc207e69fcc171e63b3dc87e7fa4e15c85645bbeef12842ac1c981
MD5 14de7a11d1de6997a782b509162dccb2
BLAKE2b-256 d950f5e27322d32273824be7ada20a2e6e3117345dd0750025f63da17cf18839

See more details on using hashes here.

File details

Details for the file fastsdk-0.4.16-py3-none-any.whl.

File metadata

  • Download URL: fastsdk-0.4.16-py3-none-any.whl
  • Upload date:
  • Size: 88.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for fastsdk-0.4.16-py3-none-any.whl
Algorithm Hash digest
SHA256 abc39a6eba1043a6ff443276bab4983c55ed7d1b73079f599a8afbd3f90e2ae2
MD5 97e174db25d62108e1d530574336b76d
BLAKE2b-256 64e482625fd09d18ba0fd8db635153df8450fa0157957b0e69874897eb91c475

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.16 This release

2 files

0.4.15

2 files

0.4.14

2 files

0.4.13

2 files

0.4.12

2 files

0.4.10

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.3.1

2 files

0.2.33

2 files

0.2.32

2 files

0.2.31

2 files

0.2.30

2 files

0.2.29

2 files

0.2.28

2 files

0.2.27

2 files

0.2.26

2 files

0.2.25

2 files

0.2.24

2 files

0.2.23

2 files

0.2.22

2 files

0.2.21

2 files

0.2.20

2 files

0.2.18

2 files

0.2.16

2 files

0.2.15

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

0.2.11

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.1

2 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