model sdk built by the 9th ditrict at tooig
Project description
nineth-sdk
nineth-sdk is a model sdk built by the 9th ditrict at tooig.
Get started with:
pip install nineth
export NINETH_API_KEY="your-api-key"
60-Second Start
from nineth import NinethClient
with NinethClient(default_model="district/1984-m3-0317") as client:
result = client.invoke(
task_input="Give me a tight market update on BTC.",
services=False,
cache=False,
)
print(result["final_response"])
That works because:
- the SDK defaults to
https://weirdpablo--rooster-api.modal.run - the SDK reads
NINETH_API_KEYautomatically - the SDK can set a client-side default model with
default_model=orNINETH_MODEL - regular requests wait up to 5 minutes by default
- streaming requests disable the read timeout by default so SSE can stay open
Quick Start
import os
from nineth import NinethClient
client = NinethClient(
api_key=os.environ["NINETH_API_KEY"],
default_model="district/1984-m3-0317",
)
response = client.invoke(
task_input="Give me a terse overview of crude oil today.",
services=False,
cache=False,
)
print(response["final_response"])
client.close()
Streaming
import os
from nineth import NinethClient
with NinethClient(
api_key=os.environ["NINETH_API_KEY"],
default_model="district/1984-m3-0317",
) as client:
try:
for event in client.stream(
task_input="Research Nvidia's latest earnings and summarize the key points.",
model="district/1984-m3-0317",
services=True,
service_names=["search_web", "read"],
cache=True,
max_iterations=6,
reasoning_effort="medium",
show_reasoning=False,
stream_timeout=None,
):
print(event["type"], event["data"])
except Exception as exc:
print("stream failed:", exc)
Health Check
from nineth import NinethClient
with NinethClient() as client:
print(client.health())
health() does not require authentication.
The SDK yields parsed SSE payloads as dictionaries. Typical public event types are:
acceptedmodel_deltaservice_callservice_responseresult
By default the stream is client-facing, not debug-facing:
acceptedis minimal and only echoes the requested public model.model_deltacontains only visible response text. Hidden reasoning, raw service tags, and internal tool markup are stripped.resultcontainsmodel,final_response, anditerations, plusthinkingonly whenshow_reasoning=True.- Internal lifecycle events such as
run_started,model_start,model_response,heartbeat, andidleare only included whendebug=True. - If the server emits an
errorframe, the SDK raisesNinethAPIErrorinstead of yielding that frame as a normal event.
Async Client
import asyncio
import os
from nineth import AsyncNinethClient
async def main():
async with AsyncNinethClient(
api_key=os.environ["NINETH_API_KEY"],
default_model="district/1984-m3-0317",
) as client:
response = await client.invoke(
task_input="Tell me whether gold is trending or ranging.",
services=False,
cache=False,
)
print(response["final_response"])
asyncio.run(main())
Payload Options
The SDK maps directly to the API request body. The most important options are:
task_inputmodelservicesservice_namescachemax_iterationsreasoning_effortshow_reasoningcontinuousimagessystem_prompt
Unknown request keys can be passed through with extra={...} in build_payload(...).
The API does not choose a default model. Set model= per call or configure default_model= on the client.
What You Get Back
invoke() returns a dictionary like:
{
"process_id": "...",
"model": "district/1984-m3-0317",
"final_response": "...",
"usage": {...},
"thinking": [],
"service_calls": [...],
"service_responses": [...],
"iterations": 2,
"events": [...],
}
stream() yields one dictionary per SSE event, for example:
{
"type": "model_delta",
"timestamp": "2026-04-03T00:00:00+00:00",
"process_id": "...",
"iteration": 1,
"data": {
"text": "NVIDIA reported..."
}
}
By default, invoke() uses a 5-minute timeout and stream() uses a dedicated streaming timeout with no read limit. Override those with timeout= and stream_timeout= on the client constructor if you need stricter limits.
thinking is empty unless you pass show_reasoning=True. reasoning_effort is optional and passed through to the provider unchanged when set.
If the server emits an error event, stream() raises NinethAPIError and closes the connection.
Authentication
Execution requests send the shared key in the X-API-Key header. The SDK reads it from:
- the
api_key=constructor argument - or the
NINETH_API_KEYenvironment variable
health() does not require authentication, but invoke() and stream() do.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nineth-0.1.2.tar.gz.
File metadata
- Download URL: nineth-0.1.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3522623f161604fb6c184ab69f0c3d814ee8472071d43bb459b0f14b9c6861fa
|
|
| MD5 |
e04ba5c7001eeb01a908de9ac610ec85
|
|
| BLAKE2b-256 |
aec35a11e6e237ad441a0ca69ced015cff3e5f4b7cbb678a953fd109bf31676c
|
File details
Details for the file nineth-0.1.2-py3-none-any.whl.
File metadata
- Download URL: nineth-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f3ce1ef2625a48d67c491701c095a349381863b7e4aaacdbb3452b4a0dfd051
|
|
| MD5 |
fc9f05b377b114428e974fbe05169b1a
|
|
| BLAKE2b-256 |
63816d418be7512123c31a7d0bb4a69bcd5f2fc9f1c1f984f8dd165b7843e69d
|