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.27

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.27
File Size Uploaded Provenance Actions
fastsdk-0.4.27.tar.gz 111.8 kB Without provenance Details for fastsdk-0.4.27.tar.gz

Built distribution (wheel)

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

Total release size: 216.0 kB

Release files / fastsdk-0.4.27.tar.gz

Download URL fastsdk-0.4.27.tar.gz
Size 111.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cbe88cc059a3cad896bbe82cbf902414b4a7da4858071ef86e8c4a7dc5c901f2
BLAKE2b-256 checksum
How to use checksums
2221c769be06667f0c66740df049ed938557598a5ae4ac54bdb9326eb24b1706
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

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

Download URL fastsdk-0.4.27-py3-none-any.whl
Size 104.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
970c4bcb826749bf451c0e2b390dde2b7df49c5d01f0463327dd007261fc8df4
BLAKE2b-256 checksum
How to use checksums
6419e4935c177592fe88b91fd88aa32a11fd98b0aaee54fd98ac4b6885a6b534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for fastsdk 0.4.27

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.4.27 This release

2 release files No provenance

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