Incredible Python SDK
Use the officially supported Python client to call the Incredible API from your projects. The SDK wraps the REST endpoints, adds helper utilities for tool chaining, and stays compatible with our live API behavior (no API key required at the moment).
Models: This guide uses small-1
, but you can swap in any public model from the Model Overview page.
Installation
PyPI (recommended)
TestPyPI (pre-release testing)
Quick Start
Notes
- Authentication: The current API does not require a key. When that changes, pass
api_key=
or setINCREDIBLE_API_KEY
. - Base URL overrides:
Incredible(base_url="https://your-proxy.example.com")
if you route through a proxy.
Token Usage
Every response includes token usage metadata:response.usage
if you ever need the legacy field.
Tool Calling & Workflow Execution
The SDK contains helpers that translate model-issued function calls into executable Python functions and back into the messages expected by the API. This mirrors our cookbook examples but removes the boilerplate.Helper | Purpose |
---|---|
build_tool_execution_plan(raw_response) | Parses model-issued tool calls into an executable plan. |
execute_plan(plan, registry) | Runs Python callables based on the plan and returns their results. |
build_follow_up_messages(original_messages, plan, results) | Produces the function_call / function_call_result messages to send back to the model. |
Streaming
Caution: Streaming support is still evolving. The current API returns SSE lines that differ from the OpenAI format, so the helper may require adjustments.
'str' object has no attribute 'decode'
, the live API changed its streaming format; continue polling until the official streaming upgrade lands.
Integrations API
List, inspect, connect, and execute Incredible integrations directly:IntegrationConnectionResult
object, with success
, redirect_url
, and instructions
fields so you can direct users through OAuth or API-key flows.
Example Projects
examples/demo.py
: An end-to-end script that hits chat, tool execution, streaming, and integrations.examples/testpypi_demo/basic_demo.py
: Minimal example installing the SDK from TestPyPI and running a quick chat.
Known Limitations
messages.count_tokens
: The live API has not enabled/v1/messages/count_tokens
yet. The SDK keeps the method for forward compatibility; for now it returns 404 with an informative error message.- Streaming: SSE handling may change; plan for a future SDK update that formalizes streaming support.
- Large Context Data: For multi-megabyte payloads (HTML, documents), always register a tool that fetches the data instead of injecting it directly into
messages
. The live API’s context window will overflow if you paste large raw content.
Release History
Version | Date | Notes |
---|---|---|
0.1.1 | 2025-10-01 | Published to TestPyPI/PyPI, tool execution helpers, integration flow, token usage attached to responses. |
0.1.0 | 2025-09-25 | Initial SDK release (basic chat + function calling). |