Skip to main content

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() 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_KEY automatically
  • 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"])

response = client.invoke(
	task_input="Give me a terse overview of crude oil today.",
	model_name="district/1984-m3-0317",
	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"]) as client:
	for event in client.stream(
		task_input="Research Nvidia's latest earnings and summarize the key points.",
		services=True,
		service_names=["search_web", "read"],
		cache=True,
		max_iterations=6,
		stream_timeout=None,
	):
		print(event["type"], event["data"])

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 event types are:

  • accepted
  • run_started
  • model_start
  • model_delta
  • model_response
  • service_call
  • service_response
  • result
  • completed
  • error

Async Client

import asyncio
import os
from nineth import AsyncNinethClient


async def main():
	async with AsyncNinethClient(api_key=os.environ["NINETH_API_KEY"]) 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_input
  • model_name
  • services
  • service_names
  • cache
  • max_iterations
  • reasoning_effort
  • continuous
  • images
  • system_prompt

Unknown request keys can be passed through with extra={...} in build_payload(...).

What You Get Back

invoke() returns a dictionary like:

{
	"process_id": "...",
	"model_name": "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_response",
	"timestamp": "2026-04-03T00:00:00+00:00",
	"process_id": "...",
	"iteration": 1,
	"data": {
		"visible_response": "..."
	}
}

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.

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_KEY environment variable

health() does not require authentication, but invoke() and stream() do.

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

nineth-0.0.8.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

nineth-0.0.8-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file nineth-0.0.8.tar.gz.

File metadata

  • Download URL: nineth-0.0.8.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nineth-0.0.8.tar.gz
Algorithm Hash digest
SHA256 e7443d31fca180124e3e0dea5ad1edce1b15c16f4917ce538fbaf3a15534974a
MD5 bf055d9df6f1801e773128c7ee54964a
BLAKE2b-256 24e76d13eaaaeeaf47524efbacdbbbe522d6227a2355c02b8d19da8c87b591b3

See more details on using hashes here.

File details

Details for the file nineth-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: nineth-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nineth-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 77519f0620cf67cf5f9b2916690d823ba13d4abdabc7262fdaf9b668820f3da8
MD5 d61d4c651ed12bbe7df13c1661d8335a
BLAKE2b-256 79ab2ef5d7c4c00482fe762488e2ecefd9890afaf12c95ce3a8db640df66af9e

See more details on using hashes here.

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