Python SDK
Theallternit Python SDK provides a provider-agnostic harness for chat completions, streaming, and tool use.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use the Allternit Python SDK for chat completions, tool use, and batch runs.
allternit Python SDK provides a provider-agnostic harness for chat completions, streaming, and tool use.
pip install allternit
from allternit import Harness
harness = Harness(api_key="YOUR_API_KEY")
response = harness.chat.completions.create(
model="allternit-balanced",
messages=[{"role": "user", "content": "Hello, world!"}]
)
print(response.choices[0].message.content)
for chunk in harness.chat.completions.create(
model="allternit-balanced",
messages=[{"role": "user", "content": "Count to 10"}],
stream=True
):
print(chunk.choices[0].delta.content or "", end="")
def get_weather(location: str) -> str:
return f"Sunny in {location}"
response = harness.chat.completions.create(
model="allternit-balanced",
messages=[{"role": "user", "content": "What's the weather in Berlin?"}],
tools=[{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}}
}
}
}]
)