Developer documentation
One Triangle Prefill SDK
A dependency-free Python client for mapped prefill and target decode in one request. Use qwen3-8b or qwen3.8-27b. You never manually transfer a cache.
01 / Quickstart
Install and configure
Python 3.9 or newer is required. Install the currently published wheel directly:
python -m pip install https://617b515ef135455fa22568d7c9d3af84-0.lambdaspaces.com/one-triangle/sdk/one_triangle-0.1.0-py3-none-any.whl Set credentials in the process environment. API access details are supplied by One Triangle.
export ONE_TRIANGLE_API_KEY="<your-api-key>"
export ONE_TRIANGLE_BASE_URL="<your-gateway-url>" api_key, base_url, and timeout can also be passed directly. Direct arguments override environment variables.
02 / Blocking calls
Call either supported model
prefill blocks until mapped prefill and target decode are complete. max_tokens defaults to 256.
Qwen3 8B
import one_triangle
result = one_triangle.prefill(
model="qwen3-8b",
context=context,
max_tokens=256,
)
print(result.decode()) Qwen3.8 27B
import one_triangle
result = one_triangle.prefill(
model="qwen3.8-27b",
context=context,
max_tokens=256,
)
print(result.decode()) 03 / Streaming
Stream decoded 8B deltas
qwen3-8b supports streaming decoded text. qwen3.8-27b currently returns a complete blocking result.
import one_triangle
for delta in one_triangle.prefill_stream(
model="qwen3-8b",
context=context,
max_tokens=256,
):
print(delta, end="", flush=True) 04 / Result fields
Inspect the complete response
- decode() / text
- The decoded text.
- usage
- Upstream token and accounting metadata.
- prefill
- Upstream mapped-prefill metadata.
- model
- The response model, or the requested alias.
- request_id
- The request identifier when the gateway supplies one.
- raw
- The complete gateway response object.
05 / HTTP API
Call /v1/prefill directly
The JSON body contains exactly model, context, and max_tokens. Unknown or missing fields are rejected.
curl "$ONE_TRIANGLE_BASE_URL/v1/prefill" \
-H "Authorization: Bearer $ONE_TRIANGLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3-8b","context":"Long source context...","max_tokens":256}' 06 / Errors
Handle gateway failures
HTTP, gateway, transport, and invalid-response failures raise one_triangle.PrefillError. Gateway responses may provide status_code and body.
import one_triangle
try:
result = one_triangle.prefill(model="qwen3-8b", context=context)
except one_triangle.PrefillError as error:
print(error)
print(error.status_code)
print(error.body) 07 / Reference
Supported aliases and limits
| Alias | Blocking | Streaming |
|---|---|---|
| qwen3-8b | Supported | Supported |
| qwen3.8-27b | Supported | Not currently available |
max_tokensdefaults to 256.- Customers call one prefill operation and never manually transfer a cache.
- The SDK accepts decoded text from
text,output,choices[0].text, orchoices[0].message.content.