Ratio1 end-to-end tutorial
Education
Ready to experience the simplicity of building and deploying AI-powered endpoints on the Ratio1 network?
In this guide, we’ll walk you through everything: launching a new node, installing the Ratio1 SDK, and deploying a basic AI time-series prediction endpoint. By the end, you’ll see just how frictionless decentralized AI can be.
1. Launch Your Ratio1 Node
We begin by spinning up a Ratio1 Edge Node. If you prefer to run nodes on separate machines - like a cloud VM or a spare computer - feel free to adapt the commands.
-d runs the container in the background.
--rm cleans up the container upon stopping.
--platform linux/amd64 ensures compatibility on certain architecture (e.g.: running on arm64, if you run on x86_64 you can skip this param)
-v r1vol:/edge_node/_local_cache/ attaches a persistent volume to store node data.
ratio1/edge_node:develop is the latest development image for the Ratio1 Edge Node.
No GPU is required for this simple app, and dAuth handles all authentication - so no manual passwords or credentials needed.
Note: Docker must be installed and running on your machine (Docker Desktop for Windows and macOS).
For more about Ratio1 Node Edge running read:
https://ratio1.ai/blog/never-settle-build-simplify-optimize-and-repeat
2. Set Up Your Environment and the Ratio1 SDK
Next, confirm that Python and pip are installed on your local machine (Windows, macOS, or Linux). If necessary, install them:
On Linux:
On Windows, download Python at python.org/downloads.
Install the Ratio1 SDK
We recommend adding --upgrade to ensure you’re always on the latest version:
3. Link the Node to Your Local SDK
To allow the newly created node to accept requests, we’ll whitelist your SDK client address in the node. First, retrieve your SDK address:
You should see output similar to:
Then, run this command on the machine hosting the Docker container to grant access:
(Replace the example address with the actual one from your r1ctl config show.)
To verify, run:
You’ll see the SDK address listed in the node’s whitelist.
4. Build and Deploy a Simple AI Endpoint
It’s time to show off how straightforward it is to create an AI prediction endpoint on Ratio1. In this example, we’ll define a simple time series model for demonstration. The Ratio1 SDK automatically packages your custom function into a FastAPI service and deploys it to the Edge Node, meaning no extra servers or complicated DevOps steps.
Sample Code: Time Series Prediction
Create a new file, e.g. time_series_prediction.py, and add the following Python code that uses the pre-existing local SDK and the remote nodes internal APIs:
How It Works
Session Setup: We create a Session to connect to the Ratio1 network, leveraging dAuth for trustless authentication.
create_web_app: This command lets you define a new web app (with a custom function exposed as a REST endpoint) for your target node.
Deploy: The script packages and sends the app to your designated node (my_node), returning a public URL. Note: In a production environment the R1 supervisor/oracle network will be taking care of this distribution and balancing task
Predict & Bounds: The run_predict function uses a built-in no-GPU model for a basic time-series forecast, then applies a heuristic to generate lower/upper bounds. This was done to demonstrate the high potential to add your own heuristics and even construct complex neuro-symbolic pipelines - albeit in this case no GPU-based neural graph is used.
Session Wait: For convenience the script then waits for 180 seconds before terminating. Note: If close_pipeline_on_timeout is set to False, your endpoint remains live even after the script ends.
Notes:
For my_node, copy the SDK address as shown by r1ctl (same you used for add_allowed) and replace the address in the example.
If you have previously installed the SDK and run the node, ensure that you have the latest versions of both. Most likely if you dont you’ll get some warning or even required update.
5. Test Your Newly Created Endpoint
Upon running python3 time_series_prediction.py, you might see something like this:
This means that our ngrok based system has finalized the endpoints deployment process and we have both the webapp deployed at our url as well as the Swagger neat doc website. Please note that the “Webapp deployed at” shows only the base URL and not the actual endpoint or endpoints. Check the Swagger for full details on your deployed endpoints and have fun!
Navigate to the Swagger UI link for a user-friendly interface to test your endpoint. Alternatively, you can hit the endpoint via curl:
Sample Response:
You’ve just built and deployed a live AI-powered microservice - no separate hosting, no building Docker images, and minimal overhead.
The Bigger Picture: Why This Matters
Developer-Friendly: Ratio1 transforms the typical AI development process, eliminating complex DevOps while making advanced AI capabilities accessible via straightforward Python scripts.
Investor Confidence: This tutorial highlights Ratio1’s ability to streamline AI deployment and reduce infrastructure overhead, illustrating a scalable and future-proof tech stack.
Multi-Node Scalability: With minimal tweaks, you can target multiple nodes, add GPU resources, or expand your API’s functionality - opening doors for more advanced real-time workloads.
Trustless Infrastructure: dAuth ensures secure authentication and data management without central authority, aligning with the broader decentralized ethos.
Conclusion
You’ve just witnessed an end-to-end example of how the Ratio1 ecosystem simplifies AI application deployment - unlocking powerful, decentralized infrastructure at your fingertips. Whether you’re a developer looking to prototype quickly, a data scientist wanting hassle-free experiment deployments, or an investor eyeing the next big step in AI and blockchain convergence, Ratio1 delivers a cohesive, future-focused approach.
Ready to do more?
Spin up additional Edge Nodes for load balancing.
Explore advanced plugins that integrate custom Python business logic.
Scale up to GPU-enabled nodes for ML training or heavy computations.
By embracing Ratio1, you step into a world where decentralization meets true usability - no more trade-offs between innovation and complexity. Welcome to the new frontier of AI infrastructure!
For more tutorials, FAQs, and advanced examples, stay tuned to our official channels and documentation.
The future of decentralized AI starts here.

Andrei Ionut Damian
Feb 2, 2025