Skip to main content

A client module

Every request needs the key, a User-Agent, a long timeout, and handling for 202 (poll the session) and for errors whose reason the user can act on.
Python

Reading a stream

fetch

An agent loop without tool calls

Tool calling is not supported, so ask the model for a JSON action in plain text and run it yourself.
Python
Each turn is one paid session. Keep loops short and max_tokens small.