Skip to main content

Provider-agnostic edge compute SDK for AI workload routing

Project description

Axon SDK

CI PyPI Python License

axonsdk.dev · GitHub

One SDK. Any compute. Route AI inference to the fastest, cheapest backend — cloud, edge, or your own infrastructure.

Axon is a universal AI compute routing layer. Stop rewriting integrations every time you switch providers, hit rate limits, or find a cheaper GPU. Point Axon at any backend — GPU clusters, container clouds, serverless functions, TEE enclaves, or your own servers — and it handles routing, failover, and cost optimisation automatically.

Axon is to AI compute what httpx is to HTTP — one client, any backend.


Supported providers

Edge & private compute

Provider Status Nodes Runtime Cost
io.net ✅ Live GPU clusters (A100, H100, RTX) nodejs, python ~$0.40/hr GPU spot
Akash Network ✅ Live Container compute marketplace nodejs, docker Pay-per-use
Acurast ✅ Live 237k+ mobile TEE nodes nodejs, wasm Pay-per-execution
Fluence ✅ Live Serverless function compute nodejs Pay-per-ms
Koii ✅ Live Distributed task nodes nodejs Pay-per-task

Cloud providers

Provider Status Services Runtime
AWS ✅ Live Lambda, ECS / Fargate, EC2 python, nodejs, docker
Google Cloud ✅ Live Cloud Run, Cloud Functions python, nodejs, docker
Azure ✅ Live Container Instances, Functions python, nodejs, docker
Cloudflare Workers ✅ Live Workers, R2, AI Gateway nodejs, wasm
Fly.io ✅ Live Fly Machines python, nodejs, docker

Provider health dashboard: Real-time status and latency for all networks → status.axonsdk.dev


Install

pip install axonsdk-py              # core SDK (mirrors the axon-ts npm packages)
pip install "axonsdk-py[inference]" # + FastAPI OpenAI-compatible server
pip install "axonsdk-py[aws]"       # + boto3
pip install "axonsdk-py[gcp]"       # + google-auth
pip install "axonsdk-py[azure]"     # + azure-identity + azure-mgmt-containerinstance
pip install "axonsdk-py[all]"       # everything

Why axonsdk-py instead of axonsdk? The axon, axonpy, and axon-sdk names on PyPI are held by unrelated projects, and axonsdk is blocked by PyPI's name-similarity rule. axonsdk-py mirrors the axon-ts repo naming convention (-py for Python, -ts for TypeScript) while the import path stays import axon unchanged.


Quick start

from axon import AxonClient, AxonRouter, RoutingStrategy, DeploymentConfig, RuntimeType

config = DeploymentConfig(
    name="my-inference-job",
    entry_point="src/worker.py",
    runtime=RuntimeType.PYTHON,
    memory_mb=512,
    timeout_ms=30_000,
    replicas=1,
)

# Single provider
async with AxonClient(provider="ionet", secret_key="...") as client:
    estimate = await client.estimate(config)
    print(f"Estimated: {estimate.amount} {estimate.token}/hr")

    deployment = await client.deploy(config)
    await client.send(deployment.id, {"prompt": "Hello"})

# Multi-provider with automatic routing
async with AxonRouter(
    providers=["ionet", "akash", "acurast"],
    secret_key="...",
    strategy=RoutingStrategy.LATENCY,
) as router:
    deployment = await router.deploy(config)
    await router.send({"prompt": "Hello"})

CLI

axon init       # interactive project setup
axon auth ionet # configure credentials
axon deploy     # deploy your workload
axon status     # list active deployments
axon send <id> <msg>    # send a test message
axon teardown <id>      # delete deployment and free resources
Command Description
axon init Interactive setup — generates axon.json, .env, and template files
axon auth [provider] Credential wizard — generates and stores keys for the selected provider
axon deploy Bundle and register your deployment
axon run-local Run locally with a mock provider runtime
axon status List deployments, processor IDs, and live status
axon send <id> <msg> Send a test message to a processor node
axon teardown <id> Delete a deployment and free provider resources
axon template list Show available built-in templates

Supported providers: ionet, akash, acurast, fluence, koii, aws, gcp, azure, cloudflare, flyio


Multi-provider routing

AxonRouter routes requests across multiple providers simultaneously, picking the best one on every call based on real-time latency, cost, and availability.

from axon import AxonRouter, RoutingStrategy

async with AxonRouter(
    providers=["ionet", "akash", "acurast", "aws", "gcp"],
    secret_key="...",
    strategy=RoutingStrategy.LATENCY,
    failure_threshold=3,
    recovery_timeout_ms=30_000,
    max_retries=2,
) as router:
    deployment = await router.deploy(config)

    # Automatically picks the highest-scoring provider
    await router.send({"prompt": "Hello"})

    # Health snapshot
    for h in await router.health():
        print(h.provider, h.latency_ms, h.status)

Routing strategies

Strategy Best for
LATENCY Interactive workloads — always picks the fastest provider
AVAILABILITY High uptime — prefers the most reliable provider
COST Batch jobs — routes to the cheapest option
BALANCED General purpose — equal weight on availability, latency, cost
ROUND_ROBIN Even load distribution

OpenAI-compatible inference endpoint

axon[inference] is a drop-in replacement for the OpenAI API that routes requests to the fastest available backend. Switch your existing OpenAI integration in two lines:

import uvicorn
from axon.inference import AxonInferenceHandler

handler = AxonInferenceHandler(
    secret_key="...",
    ionet_endpoint="...",
    akash_endpoint="...",
    strategy="cost",  # 'cost' | 'latency' | 'balanced'
)
uvicorn.run(handler.app, host="0.0.0.0", port=8000)

Then point any OpenAI client at http://localhost:8000:

import openai

client = openai.OpenAI(
    base_url="http://localhost:8000/v1",
    api_key=AXON_SECRET_KEY,
)

response = client.chat.completions.create(
    model="axon-llama-3-70b",
    messages=[{"role": "user", "content": "Explain edge AI in one paragraph."}],
)

Available models

Model ID Backend Notes
axon-llama-3-70b io.net A100 GPU — best quality
axon-mistral-7b io.net GPU, most cost-efficient
axon-llama-3-8b Akash Container compute, moderate cost
axon-tee-phi-3-mini Acurast TEE node — private execution

Cloud provider authentication

AWS

pip install axonsdk-py[aws]

Set env vars (or use IAM role / ~/.aws/credentials):

export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_DEFAULT_REGION=us-east-1

GCP

pip install axonsdk-py[gcp]
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
export GCP_PROJECT_ID=my-project
export GCP_REGION=us-central1

Azure

pip install axonsdk-py[azure]
export AZURE_TENANT_ID=...
export AZURE_CLIENT_ID=...
export AZURE_CLIENT_SECRET=...
export AZURE_SUBSCRIPTION_ID=...
export AZURE_RESOURCE_GROUP=my-rg

Cloudflare Workers

export CF_API_TOKEN=...
export CF_ACCOUNT_ID=...

Fly.io

export FLY_API_TOKEN=...   # flyctl auth token
export FLY_APP_NAME=...    # flyctl apps create <name>

Security

  • Secrets never leave .env — the auth wizard generates keys locally and stores them with chmod 600. Never logged or transmitted.
  • SSRF protection — all HTTP calls validate URLs against a private-IP blocklist and enforce HTTPS.
  • DNS rebinding defence — resolves hostnames to IPs before opening connections, then re-validates the IP.
  • Prototype pollution prevention — remote JSON payloads are parsed with key blocklisting; environment maps use Object.create(null).
  • Response size caps — all provider clients enforce a 1 MiB response cap; mock runtime enforces 4 MiB.
  • Input validationprocessorId and deployment names validated for control characters and path traversal sequences.
  • Secret filtering — environment variables with _KEY, _SECRET, _TOKEN, _PASSWORD, _MNEMONIC, or _PRIVATE_KEY suffixes are stripped before bundle injection.

Project structure

axon/
├── src/
│   └── axon/
│       ├── providers/
│       │   ├── ionet.py       # io.net GPU provider
│       │   ├── akash.py       # Akash Network provider
│       │   ├── acurast.py     # Acurast TEE provider
│       │   ├── fluence.py     # Fluence serverless provider
│       │   ├── koii.py        # Koii task node provider
│       │   ├── aws.py         # AWS Lambda / ECS provider
│       │   ├── gcp.py         # Google Cloud Run provider
│       │   ├── azure.py       # Azure Container Instances provider
│       │   ├── cloudflare.py  # Cloudflare Workers provider
│       │   └── fly.py         # Fly.io Machines provider
│       ├── inference/         # OpenAI-compatible FastAPI server
│       ├── cli/               # axon CLI (Typer)
│       └── utils/             # retry, security helpers
└── tests/
    └── providers/             # unit tests for all 10 providers

Development

git clone https://github.com/deyzho/axon.git
cd axon
pip install -e ".[all,dev]"
pytest
mypy src/

Contributing

Pull requests are welcome. See CONTRIBUTING.md to get started.

High-impact areas:

  • Integration tests against live provider sandboxes
  • Additional provider support
  • Template library

Ecosystem

Axon is the Python compute routing SDK. If you're building with TypeScript / Node.js, React Native, or deploying via a CLI, see the companion repositories:

Package Description
@phonixsdk/sdk TypeScript SDK — same providers, same routing strategies
@phonixsdk/mobile React Native / Expo SDK for iOS & Android
@phonixsdk/cli CLI — axon init, axon deploy, axon status
@phonixsdk/inference OpenAI-compatible inference handler for Next.js

phonixsdk.dev — full documentation for the TypeScript ecosystem.


License

Apache-2.0 — see LICENSE.


axonsdk.dev · deyzho@me.com · Apache-2.0

Axon is not affiliated with io.net, Akash Network, Acurast, Fluence, or Koii. Provider names and trademarks belong to their respective owners.

Project details


Download files

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

Source Distribution

axonsdk_py-0.1.10.tar.gz (84.9 kB view details)

Uploaded Source

Built Distribution

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

axonsdk_py-0.1.10-py3-none-any.whl (80.6 kB view details)

Uploaded Python 3

File details

Details for the file axonsdk_py-0.1.10.tar.gz.

File metadata

  • Download URL: axonsdk_py-0.1.10.tar.gz
  • Upload date:
  • Size: 84.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for axonsdk_py-0.1.10.tar.gz
Algorithm Hash digest
SHA256 ccf9fd6973f374a746b7f6b412b834835db5ca1e52632cebb42c781d9b8ec9cd
MD5 67ae58131ecf95aa7b99164c20b5815c
BLAKE2b-256 7e236c16e30305b29532f09a7b8b4a2bd78e0ac64a1c21efd3f88bf6e3dae040

See more details on using hashes here.

Provenance

The following attestation bundles were made for axonsdk_py-0.1.10.tar.gz:

Publisher: publish.yml on deyzho/axon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file axonsdk_py-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: axonsdk_py-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 80.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for axonsdk_py-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 5324d3aa238531045095d1b6a42964b6910c077bfb116ad3259b65b3ffb9e601
MD5 92fd724e82eb7806113932050a180288
BLAKE2b-256 fb139142d028a737582c8edaf47d9bb24a7f7b306deaea2d946d0bff519f30ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for axonsdk_py-0.1.10-py3-none-any.whl:

Publisher: publish.yml on deyzho/axon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page