Skip to main content

100xprompt (Python SDK)

Python SDK for 100XPrompt, the AI coding agent.

A fully-typed client for the 100XPrompt agent server, sync and async, and the engine that serves it, started for you. Use it to drive sessions, stream events, manage models, providers and MCP servers, and build your own tools, bots and CI jobs on top of 100XPrompt.

Install

pip install 100xprompt

The distribution is 100xprompt; the import is hundredxprompt (a Python module name cannot start with a digit). Python 3.9 or newer.

The engine comes with it: pip picks the wheel for your machine, which carries the 100xprompt engine at the package's own version (macOS 13+ on Apple silicon or Intel; Linux x64 or arm64 with glibc 2.17+ or musl; Windows x64). Nothing else to install. Elsewhere pip installs the pure wheel, which runs a 100xprompt CLI you install yourself (curl -fsSL https://100xprompt.com/install | bash).

Sign in once

python -m hundredxprompt sign-in

It opens your browser. The sign-in belongs to the machine, so if you already use the 100XPrompt CLI or desktop app here, you are signed in already. From code: hundredxprompt.sign_in().

Quick start

from hundredxprompt import Client
from hundredxprompt.types import TextPart, TextPartInput

with Client.start() as client:
    session = client.session.create(title="demo")
    reply = client.session.prompt(
        session.id,
        parts=[TextPartInput(text="Write unit tests for src/index.ts")],
    )
    print("".join(p.text for p in reply.parts if isinstance(p, TextPart)))

Client.start() starts the engine (100xprompt serve) on 127.0.0.1 and returns a client for it; leaving the with block (or client.close()) stops the server. The server takes port 4096 when it is free and any free port otherwise; pass port= to pin one, cli= to run your own 100xprompt CLI instead of the engine (a path, or a command such as ["bun", "run", "src/main.ts"]), config= to layer config over the user's own, and cwd= for the project it starts in.

The server requires a token on every request, on loopback too. start() picks a random one (or takes token=), hands it to the server, and the client sends it.

Stream events

client.event.subscribe() yields typed events and stays subscribed: when the connection drops it reconnects with Last-Event-ID, so the server replays what was missed (or sends ServerReset when it cannot). Heartbeats are skipped.

from hundredxprompt import Client
from hundredxprompt.types import EventMessagePartUpdated, EventServerConnected, EventSessionIdle, TextPart, TextPartInput

with Client.start() as client:
    session = client.session.create()
    with client.event.subscribe() as events:
        for event in events:
            if isinstance(event, EventServerConnected):
                client.session.prompt_async(session.id, parts=[TextPartInput(text="Hello!")])
            elif isinstance(event, EventMessagePartUpdated) and isinstance(event.properties.part, TextPart):
                print(event.properties.part.text)
            elif isinstance(event, EventSessionIdle) and event.properties.session_id == session.id:
                break

An event type this SDK version does not know yet (a newer server's) arrives as UnknownEvent, so a long-lived subscription never fails on one. Tune reconnects with retry_delay, max_retry_delay, max_retry_attempts, max_retry_duration, liveness_timeout and on_error.

Async

AsyncClient has the same methods, awaited:

import asyncio

from hundredxprompt import AsyncClient
from hundredxprompt.types import TextPartInput


async def main() -> None:
    async with await AsyncClient.start() as client:
        session = await client.session.create()
        reply = await client.session.prompt(session.id, parts=[TextPartInput(text="Hi")])
        print(reply.info.tokens)
        async with client.event.subscribe() as events:
            async for event in events:
                print(event.type)
                break


asyncio.run(main())

Server and client separately

from hundredxprompt import Server

with Server.start(port=4096) as server:
    client = server.client()  # closing it leaves the server running
    print(client.global_.health().version)

The SDK has no terminal UI. To watch or steer a server your program started, run the 100XPrompt CLI against it: 100xprompt attach <server.url> with HUNDREDXPROMPT_SERVER_TOKEN set to server.token.

Connect to an existing server

If a 100xprompt serve is already running, locally or remotely, point a client at it. serve prints the token it requires; set HUNDREDXPROMPT_SERVER_TOKEN before starting it to choose the token yourself.

import os

from hundredxprompt import Client

client = Client("https://your-host.example.com", token=os.environ["HUNDREDXPROMPT_SERVER_TOKEN"])

Pass directory= to scope every call to a project folder (a call's own directory= wins).

Authentication, rate limiting and access control are enforced by the server, not the SDK. Secure your hosted instance accordingly.

Structured output

from pydantic import BaseModel

from hundredxprompt.types import TextPartInput


class City(BaseModel):
    name: str
    population: int


result = client.session.prompt_structured(
    session.id, output_type=City, parts=[TextPartInput(text="The biggest city in France?")]
)
print(result.structured.population)  # a validated City

Pass schema= (a JSON Schema dict) instead of output_type= to get the value as plain JSON. When the model never delivers a valid value, it raises StructuredOutputFailedError.

Every operation

Every operation of the API is a method named after its operationId: session.prompt is client.session.prompt(...), global.health is client.global_.health() (a trailing _ where the name is a Python keyword), and session.revert.preview is client.session.revert_preview(...). Path parameters are positional; query parameters and body fields are keyword arguments in snake case (message_id=, sent as messageID). Every method also takes extra_headers, extra_query, extra_body and timeout.

hundredxprompt.OPERATIONS lists every operation with the method that calls it.

Types

Every request and response model, and every event, is generated from the server's OpenAPI spec and lives in hundredxprompt.types:

from hundredxprompt.types import AssistantMessage, Event, Part, Session, TextPartInput

Models are pydantic v2 models with snake-case attributes; model.to_dict() gives the server's JSON. Unions such as Part, Message and Event are discriminated by type (or role), so isinstance tells them apart. A value from a newer server that a model does not know is kept as sent, with a warning on the hundredxprompt logger, rather than failing the call.

Errors

Exception When
LicenseError 403: the engine refuses work because this machine's account is not licensed. message says why and what to do, in words for a person. A subclass of PermissionDeniedError.
BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, InternalServerError 400, 401, 403, 404, 409, 5xx; any other status is APIStatusError. All carry status_code and the server's body.
NoReplyError session.prompt ended without an assistant message: aborted (.aborted) or failed before the model answered (.error).
APIConnectionError, APITimeoutError The server could not be reached, or did not answer in time.
EventStreamRejectedError The event stream was refused (401/403/404); it does not reconnect.
ServerStartError, CLINotFoundError start() could not run 100xprompt serve (CLINotFoundError: no engine for this machine and no CLI); output holds what it printed.

All of them derive from HundredXPromptError. is_license_error(value) is the same guard as the JS SDK's isLicenseError: it recognises the licence refusal on any of these errors, or on an error object as the server writes it.

from hundredxprompt import LicenseError

try:
    client.session.prompt(session.id, parts=[TextPartInput(text="hi")])
except LicenseError as refused:
    print(refused.message)  # for example "Sign in to use 100xprompt ..."

Reads (sessions, messages, the event stream), abort, deleting your own sessions and signing in still work while the licence refuses work.

Examples

examples/: create_session.py, prompt.py, stream_events.py, async_client.py.

Development

The typed layer (src/hundredxprompt/_generated/, _version.py) is generated from packages/sdk/openapi.json, the spec the JS SDK is generated from, by script/generate.py. The repo's script/generate.ts runs it after regenerating the spec, and script/build.ts runs it before every build, so each CLI release regenerates the SDK at the CLI's version.

uv sync
uv run python script/generate.py           # regenerate; --check exits 1 when stale
uv run ruff check . && uv run ruff format --check . && uv run mypy
uv run pytest tests/unit                   # no CLI needed
uv run pytest tests/integration            # a real `100xprompt serve` with a scripted model
bun script/build.ts                        # regenerate, then build the wheel and sdist into dist/

The integration tests use the 100xprompt on your PATH (or HUNDREDXPROMPT_TEST_CLI), isolated from your own data, with a local fake model provider. The licence test runs the CLI from this checkout's source with bun (a release build ignores the settings it needs), and is skipped without it.

License

Proprietary. See LICENSE.

Metadata

Release files for 100xprompt 0.1.178

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for 100xprompt 0.1.178
File Size Uploaded Provenance Actions
100xprompt-0.1.178.tar.gz 122.3 kB Without provenance Details for 100xprompt-0.1.178.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for 100xprompt 0.1.178
File Actions
100xprompt-0.1.178-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for 100xprompt-0.1.178-py3-none-win_amd64.whl
100xprompt-0.1.178-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for 100xprompt-0.1.178-py3-none-musllinux_1_2_x86_64.whl
100xprompt-0.1.178-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for 100xprompt-0.1.178-py3-none-musllinux_1_2_aarch64.whl
100xprompt-0.1.178-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for 100xprompt-0.1.178-py3-none-manylinux_2_17_x86_64.whl
100xprompt-0.1.178-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for 100xprompt-0.1.178-py3-none-manylinux_2_17_aarch64.whl
100xprompt-0.1.178-py3-none-macosx_13_0_x86_64.whl Python 3 none macOS 13.0+ x86-64 Details for 100xprompt-0.1.178-py3-none-macosx_13_0_x86_64.whl
100xprompt-0.1.178-py3-none-macosx_13_0_arm64.whl Python 3 none macOS 13.0+ ARM64 Details for 100xprompt-0.1.178-py3-none-macosx_13_0_arm64.whl
100xprompt-0.1.178-py3-none-any.whl Python 3 none any Details for 100xprompt-0.1.178-py3-none-any.whl

Total release size: 399.0 MB

Release files / 100xprompt-0.1.178.tar.gz

Download URL 100xprompt-0.1.178.tar.gz
Size 122.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b7c24a74721bb85a58d783329f721e141eea65735eca57ac57b2517c4a1e1ffd
BLAKE2b-256 checksum
How to use checksums
051919e5a83a8d53277972d9812f530b7cb5c29d10e7a7ad7529eb86ec09ac9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-win_amd64.whl

Download URL 100xprompt-0.1.178-py3-none-win_amd64.whl
Size 58.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
43edaee1da33c3bc4af5b8002a540b64ef3f88b28f9c99495f384ad3fc7782a7
BLAKE2b-256 checksum
How to use checksums
a4e34d6cb6228090b4523ee66bdeb921ba02bd21c9b3226eeadc1b91650b629b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-musllinux_1_2_x86_64.whl

Download URL 100xprompt-0.1.178-py3-none-musllinux_1_2_x86_64.whl
Size 53.5 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
8b01838c2212902e4451488d2fa0c23e0225df8f96b5d307bdb7f2c432d1daa2
BLAKE2b-256 checksum
How to use checksums
d066b3ba7e6de61616b50c0ad56b2e3f4617cf179315eceaed77957a8ae85f90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-musllinux_1_2_aarch64.whl

Download URL 100xprompt-0.1.178-py3-none-musllinux_1_2_aarch64.whl
Size 53.2 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
9818e268c7b4a743628c671fb6c2fdc52b9216e67db12b902d7a5b030447e4c4
BLAKE2b-256 checksum
How to use checksums
f898e5a6a90f82b101ed471778ea15d5fe03ca6b724e247d7572d07a43d7879a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-manylinux_2_17_x86_64.whl

Download URL 100xprompt-0.1.178-py3-none-manylinux_2_17_x86_64.whl
Size 55.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
27faa6725acac1bae9d14fa1e07441590f11b1747446d1fade4fb950697d207f
BLAKE2b-256 checksum
How to use checksums
9abe4dd76d655e3684359a4c149e2b2817bc8937257f2dde1293fd1d6908e4c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-manylinux_2_17_aarch64.whl

Download URL 100xprompt-0.1.178-py3-none-manylinux_2_17_aarch64.whl
Size 55.1 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
2d07b73ca743199997fc4c910a14154f82c77c1213f61e2abeed0d27f8b0fb14
BLAKE2b-256 checksum
How to use checksums
ec7c9834d505770020979e12733df270fa0b6497ae646f15e81fbc9bbd406a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-macosx_13_0_x86_64.whl

Download URL 100xprompt-0.1.178-py3-none-macosx_13_0_x86_64.whl
Size 83.5 MB
Tags Python 3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
4066d7977eaefe07b324f64eed6520a9d64b4dc3ef1278ab86feb46b60e99d02
BLAKE2b-256 checksum
How to use checksums
733e9f3d1af23ebef061ad34fd2739a51a516c64943aa72a378603c072617c6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-macosx_13_0_arm64.whl

Download URL 100xprompt-0.1.178-py3-none-macosx_13_0_arm64.whl
Size 39.6 MB
Tags Python 3 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
e86a8326c38bac514589d0e0672306c40168c029265e0407d4b59fc50b820b16
BLAKE2b-256 checksum
How to use checksums
d854270409e6005ce17c57596f1448592783932cf947620ac4926a020e1fc800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / 100xprompt-0.1.178-py3-none-any.whl

Download URL 100xprompt-0.1.178-py3-none-any.whl
Size 97.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
976b8b77c7725b40f31045a44a417c890a004bc7d8448358792725d828bba771
BLAKE2b-256 checksum
How to use checksums
a5b84c1e772c1f28f798760fd9a1d59f04d01e74111397bcf82999c6a00c2d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Security for 100xprompt 0.1.178

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page