Itzam Python SDK provides a simple interface to interact with the Itzam API for text generation, thread management, model listing, and run inspection.
pip install itzamfrom itzam import Itzam
client = Itzam("your-api-key")
response = client.text.generate(
workflow_slug="your_workflow_slug",
input="Hello, Itzam!",
stream=False
)
print(response.text)You can provide your API key directly or set it as an environment variable:
export ITZAM_API_KEY=your-api-keyThen initialize without arguments:
from itzam import Itzam
client = Itzam()- Text Generation: Generate text using your workflows.
- Threads: Create and manage threads for conversations.
- Models: List available models and their details.
- Runs: Inspect previous runs and their metadata.
python3 -m itzam.modelsresponse = client.text.generate(
workflow_slug="your_workflow_slug",
input="Write a poem about the sea."
)
print(response.text)for delta in client.text.generate(
workflow_slug="your_workflow_slug",
input="Tell me a story.",
stream=True
):
print(delta, end="", flush=True)models = client.models.list()
for model in models:
print(model.name, model.tag)thread = client.threads.create(
workflow_slug="your_workflow_slug",
name="Support Conversation"
)
print(thread.id)run = client.runs.get("run_id")
print(run.output)You can specify a custom API base URL if needed:
client = Itzam(api_key="your-api-key", base_url="https://itz.am")- Python 3.10+
requestspydanticrichpython-dotenv(optional, for environment variable loading)
MIT
For more details, see the API documentation.