Skip to main content

Python SDK

ainative-python (v3.1.1, real published PyPI package) is the official Python client for AINative/ZeroDB. Every sample below was run live against the real API with an instant-db project.

Install

The PyPI package name and the Python import name are different.

pip install ainative-python
from ainative import AINativeClient

The PyPI distribution is ainative-python, but the installed, importable module is ainative (not ainative_python).

Not this one: the separate PyPI package literally named zerodb belongs to an unrelated company (ZeroDB Inc.) and is not affiliated with AINative. Use ainative-python.

Base URL bug found during live testing — use a trailing slash

Passing a base_url without a trailing slash makes every request fail with a 404/405. Internally the client builds URLs with Python's urljoin, which drops the last path segment of a base URL that has no trailing slash — so base_url="https://api.ainative.studio" silently loses the /api/v1 prefix on every call. Tracked as core#9828.

Verified working: always pass an explicit trailing slash:

client = AINativeClient(
    api_key="your-api-key",
    base_url="https://api.ainative.studio/api/v1/",  # trailing slash required
)

Quickstart — verified live

from ainative import AINativeClient

client = AINativeClient(
    api_key="your-api-key",
    base_url="https://api.ainative.studio/api/v1/",
)

# Store a memory
memory = client.zerodb.memory.create(
    "your-project-id",
    content="User prefers dark mode",
    tags=["preferences", "ui"],
)
print(memory["memory_id"])

# List memories
memories = client.zerodb.memory.list("your-project-id")
print(memories["total"], "memories stored")

# Search memories (semantic by default)
results = client.zerodb.memory.search("your-project-id", query="dark mode preference")
Verified: this exact sequence created, listed, and retrieved a real memory record against the live API.

Vectors

client.zerodb.vectors.upsert(project_id, vectors=[...])
results = client.zerodb.vectors.search(project_id, query_vector=[...], top_k=5)

Reference

  • PyPI package: pypi.org/project/ainative-python
  • Also exposes agent_swarm, agent_orchestration, agent_coordination, agent_learning, agent_state clients for multi-agent workflows.
  • Need an API key fast? MCP server setup creates one with no signup.
ZeroDB — part of AINative Studio