Python Client Guide
datafuse-sdk is a typed client generated from the Datafuse API. Each method maps to one v1 route.
pip install datafuse-sdk
1. Create a Client
Pass the credential yourself: the SDK does not read environment variables. The client sends it as both Authorization: Bearer and x-api-key, so one client works with either credential type.
import os
from datafuse import Datafuse
sdk = Datafuse(api_key=os.environ["DATAFUSE_API_KEY"])
| You pass | The client can |
|---|---|
An API key (df_live_...) | Resolve tools, list tools, invoke tools, list connected accounts, browse providers |
| An access token | Everything above except connected accounts, plus list, create, test and delete integrations |
For a self-hosted deployment add base_url="https://your-datafuse-host".
2. Find Your Integration
Listing integrations needs an access token. Do this once and keep the id.
admin = Datafuse(api_key=os.environ["DF_TOKEN"])
page = admin.integrations.list_integrations_api_v1_integrations_get()
for integration in page.items:
print(integration.id, integration.provider_key, integration.health_status)
# Choose the integration to use by its provider.
integration = next(item for item in page.items if item.provider_key == "deepseek")
integration_id = str(integration.id)
!NOTE Version 1.0.0 of the Python SDK does not expose the
verifiedfield on integrations, or thetools/schemaroute. ReadverifiedfromGET /api/v1/integrationsdirectly, as shown in the quickstart.
3. Resolve Tools
tools = sdk.integrations.resolve_tools_api_v1_integrations_id_resolve_tools_post(integration_id)
for tool in tools:
print(tool.slug, (tool.input_schema or {}).get("required", []))
On an integration whose credentials are not verified this raises datafuse.generated.exceptions.ForbiddenException.
4. Invoke a Tool
Pass a tool's slug as tool_key. This example calls DeepSeek's read-only deepseek_list_models; use a slug and arguments from your own integration.
from datafuse.generated import IntegrationInvokeRequest
result = sdk.integrations.invoke_tool_api_v1_integrations_id_invoke_post(
integration_id,
IntegrationInvokeRequest(tool_key="deepseek_list_models", arguments={}),
)
print(result.successful)
print(result.data if result.successful else result.error)
Client Layout
| Attribute | Routes |
|---|---|
sdk.integrations | Integrations, tool resolution, invoke |
sdk.providers | Provider catalog |
sdk.connected_accounts | Connected accounts |
sdk.api_keys, sdk.authentication | API keys, login and refresh |
sdk.organizations, sdk.billing, sdk.compliance_audit_logs | Account, billing and audit |
Method names follow the route they call. Use your editor's completion on each attribute to browse them.
Next Steps
- See which credential each route accepts in the Client Overview.
- Open the TypeScript client guide for Node.js.