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 aFastClient. Call any endpoint withsubmit_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:
- APIPod services (job-based, the natural counterpart to fastSDK)
- Replicate models (official and community)
- RunPod serverless endpoints
- Cog services
- Any OpenAPI 3.0 service (FastAPI, Flask, ...)
- Socaity.ai services
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.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastsdk-0.4.21.tar.gz | 101.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastsdk-0.4.21-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 192.7 kB
Release files / fastsdk-0.4.21.tar.gz
| Download URL | fastsdk-0.4.21.tar.gz |
|---|---|
| Size | 101.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1dd0e15f449e40bafe6573729617af2de87ec7ae12fd4ca22d2031d11a35672
|
|
BLAKE2b-256 checksum How to use checksums |
273287b68aa5a781a15369be254b8098a3af85d6fa5264c2985366bf3f0f3ab2
|
| 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.21-py3-none-any.whl
| Download URL | fastsdk-0.4.21-py3-none-any.whl |
|---|---|
| Size | 91.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78eff24063df3684406f2a35b28603ab5836b2e35d251e7c728e19096eb1b9e4
|
|
BLAKE2b-256 checksum How to use checksums |
e1274592480deee9017b3fed16c9a533f99386f7699470f941bbb876bb2119fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|