SDKs

Official SDKs

Typed Python and TypeScript clients for the Claix API, plus tools for LangChain, LangGraph, CrewAI, and LlamaIndex.

Python SDK

Official Claix Python client

Endpoint

PIPpip install claix-ai

claix-ai is the typed Python SDK for Claix. Import stays from claix import ClaixClient. The primary calls are client.retrieve.ask (live, allowlisted reads) and client.guard.check (allow or deny for INSERT, UPDATE, and DELETE; Claix does not run the statement). The same client also covers Ingest, and drops into LangChain, LangGraph, CrewAI, and LlamaIndex.

Requires Python ≥ 3.10. Auth is the same API key as REST, MCP, and A2A: header x-api-key, or environment variable CLAIX_API_KEY.

The same client is also available in TypeScript: npm install claix-ai, with tools for LangChain.js, CrewAI, and LlamaIndex.TS.

2. Install

pip install claix-ai
pip install 'claix-ai[langchain]'
pip install 'claix-ai[crewai]'
pip install 'claix-ai[llamaindex]'
pip install 'claix-ai[all]'

Core extras pull httpx and Pydantic v2. Framework extras add the matching tool adapters documented in this section.

3. Authentication

Recommended — environment variable:

export CLAIX_API_KEY=ck_...

Or pass api_key= to ClaixClient / AsyncClaixClient. The client sends x-api-key on every request (Bearer is also accepted by the API). Default timeout is 120s, with retries on 429, 502, 503, 504 and transport errors.

4. Quickstart

from claix import ClaixClient

client = ClaixClient()  # reads CLAIX_API_KEY

answers = client.retrieve.ask("orders-agent", [
    {"question": "How many orders are confirmed?", "format": "int"},
])
print(answers.ia_response)

decision = client.guard.check(
    "UPDATE orders SET discount = $1 WHERE id = $2",
    params=[0.35, 90421],
)
print(decision.allowed, decision.reason)

Async client, and Ingest:

from claix import AsyncClaixClient

async with AsyncClaixClient() as client:
    answers = await client.retrieve.ask("orders-agent", ["How many orders are confirmed?"])
    doc = await client.extract.pdf("invoice.pdf", schema_id="...")
    print(answers.ia_response, doc.data)

5. Method map

SDK methodHTTP
client.retrieve.ask(agent_name, questions)POST /retrieve/{agent_name}
client.guard.check(sql, params=None, connection_id=None)POST /check-sql
client.extract.pdf(..., is_agent_mode=False)POST /api/pdf-json or POST /agent/pdf-json
client.extract.excel(...)POST /api/excel-json or POST /agent/excel-json
client.extract.document(...)POST /api/doc-json or POST /agent/doc-json
client.extract.image(...)POST /api/img-json or POST /agent/img-json
client.extract.text(content, schema_id, ...)POST /api/txt-json or POST /agent/txt-json
client.extract.audio(...)POST /api/audio-json or POST /agent/audio-json
client.extract.json_to_excel(schema_id=..., data=...)POST /api/json-excel
client.context.get(document_id)GET /get-document/{id}
client.context.ask(document_id, questions)POST /document-context/{id} (max 5 × 400 chars)
client.context.delete(document_id)DELETE /delete-document/{id}
client.context.replace(document_id, new_content_document_id)POST /replace-document
client.spaces.create(name)POST /create-space
client.spaces.add(document_id, space_id)POST /add-space
client.spaces.ask(space_id, questions)POST /space-context/{id}
client.spaces.remove_document(document_id)DELETE /remove-document-from-space/{id}
client.spaces.delete(space_id)DELETE /delete-space/{id}
client.schemas.list()GET /api/schemas
client.schemas.get(schema_id)GET /api/get-schema/{schema_id}
client.schemas.create(...)POST /api/create-schema
client.schemas.update(schema_id, ...)PUT /api/update-schema/{schema_id}
client.schemas.delete(schema_id)POST /api/delete-schema

Questions are sent as { question, format } (string, int, boolean, timestamp, or array). A plain string is sent as format: "string". ia_response follows that format, or is null when evidence is missing. If source verification is enabled on document or knowledge space queries, each item becomes {value, source}. Extraction and Agent mode include log_id; with source verification on the schema each field is {value, source}.

6. Errors

All errors subclass ClaixError and expose status_code plus the {error, detalle} payload: ClaixAuthenticationError (401), ClaixNotFoundError (404), ClaixValidationError (400/413/422), ClaixRateLimitError (429), ClaixTimeoutError, ClaixConnectionError, ClaixAPIError (5xx).

Request examples

pip install claix-ai
export CLAIX_API_KEY=ck_...

python - <<'PY'
from claix import ClaixClient
client = ClaixClient()
print(client.retrieve.ask("orders-agent", ["How many orders are confirmed?"]).ia_response)
PY