Nexus6 Python SDK
Installation
pip install nexus6-sdk
Quick Start — Register a new AI agent
from nexus6_sdk import Nexus6Client
client = Nexus6Client()
# Register — you get an identity + RSA key pair
result = client.register(name="My AI Agent")
print(result["api_key"]) # nxs6_xxx — your identifier
print(result["public_key"]) # RSA public key (stored on Nexus6)
print(result["private_key"]) # RSA private key — save securely!
Quick Start — Sign and verify (5 lines)
import time
from nexus6_sdk import Nexus6Client
client = Nexus6Client()
# 1. Sign a request with your private key
message = f"POST:/api/v1/tools:{int(time.time())}"
signature = client.sign_request(private_key_pem, message)
# 2. Verify on the other side
result = client.verify(
api_key="nxs6_xxx",
signature=signature,
timestamp=str(int(time.time())),
method="POST",
path="/api/v1/tools"
)
print(result["verified"]) # True
How It Works
AI Agent Platform
│ │
├─ Register → get RSA keys │
│ │
├─ sign_request(private_key, │
│ "GET:/api/data:ts") │
│ │
├─ Send headers: │
│ X-API-Key: nxs6_xxx │
│ X-Agent-Signature: <base64> │
│ X-Agent-Timestamp: <ts> │
│ ─────► │
│ ├─ Lookup public key by api_key
│ ├─ Verify RSA signature locally
│ ├─ ✅ Identity verified (under 100ms)
│ └─ Process request
Platform Integration (FastAPI)
One line of middleware. Every incoming request is verified automatically.
from fastapi import FastAPI, Request
from nexus6_sdk.middleware import Nexus6Middleware
app = FastAPI()
app.add_middleware(Nexus6Middleware)
@app.post("/api/chat")
async def chat(request: Request):
identity = request.state.ai_identity
return {"message": f"Verified AI: {identity['identity']['api_key']}"}
Expected Headers
| Header | Value | Required |
|---|---|---|
X-API-Key |
nxs6_xxx |
Yes |
X-Agent-Signature |
base64(RSA-SHA256) | Yes |
X-Agent-Timestamp |
Unix timestamp | Yes |
Custom Configuration
app.add_middleware(
Nexus6Middleware,
base_url="https://your-nexus6-instance.com",
exclude_paths=["/health", "/docs"],
signature_max_age_seconds=60, # default: 300
)
API Reference
Nexus6Client
| Method | Returns | Description |
|---|---|---|
register(name, **kwargs) |
{success, agent_id, api_key, private_key, public_key} |
Register new AI agent with RSA keys |
verify(api_key, signature, timestamp, method, path) |
{verified, id, name, ...} |
Verify RSA signature against Nexus6 |
sign_request(private_key_pem, message) |
str |
Sign a message with RSA private key |
build_auth_headers(private_key_pem, method, path) |
{X-Agent-Signature, X-Agent-Timestamp} |
Build signature headers |
generate_keys(ai_id, x_api_key) |
{success, public_key, private_key} |
Generate RSA key pair and upload public key |
fetch_public_key(ai_id) |
str or None |
Fetch public key by agent ID |
fetch_public_key_by_api_key(api_key) |
str or None |
Fetch public key by API key |
verify_signature_offline(public_key_pem, message, signature) |
bool |
Verify RSA signature locally |
Register Parameters
| Parameter | Required | Description |
|---|---|---|
name |
Yes | AI agent name |
title |
No | Display title |
ai_type |
No | Type: assistant, coding, customer_service, etc. |
description |
No | What the AI does |
developer_email |
No | Developer contact |
Middleware Options
| Option | Default | Description |
|---|---|---|
base_url |
https://nexus-7xp6n.ondigitalocean.app |
Nexus6 API endpoint |
mode |
"signature" |
Verification mode (signature or legacy) |
exclude_paths |
["/health", "/docs", ...] |
Paths to skip |
signature_max_age_seconds |
300 |
Max signature age (5 min) |
on_verified |
None |
Callback(request, identity) |
Requirements
- Python 3.9+
httpxstarlette(for middleware)cryptography(for RSA signing/verification)
License
MIT
Metadata
Release files for nexus6-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nexus6_sdk-0.2.0.tar.gz | 9.8 kB | Without provenance | Details for nexus6_sdk-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nexus6_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for nexus6_sdk-0.2.0-py3-none-any.whl |
Total release size: 19.1 kB
Release files / nexus6_sdk-0.2.0.tar.gz
| Download URL | nexus6_sdk-0.2.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87b236052867526791e75e7932d755ba73c8070dd5111036ca83432636cdf719
|
|
BLAKE2b-256 checksum How to use checksums |
281be9eef001b5d0483abd0037a74096d6640c5c789e93fb486448b9810839c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / nexus6_sdk-0.2.0-py3-none-any.whl
| Download URL | nexus6_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e558f7906197300dbca5b2990c6ab9d31ba56528669c50747faa605d326a770
|
|
BLAKE2b-256 checksum How to use checksums |
c6ac49f4f946c5cebd0f0ef74d7a151687fbdb038abd13f3d7575da4cbb6d81b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for nexus6-sdk 0.2.0
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.