SDKs

Official SDKs

Typed Python client for the Claix API, plus drop-in 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 the Claix document intelligence API (OpenAPI 1.8.2). Import stays from claix import ClaixClient. Use it for extraction, Agent mode, persisted documents, and knowledge spaces — or drop the same client 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.

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
result = client.extract.pdf("invoice.pdf", schema_id="3c7a9f21-4b8e-4d1a-9c6f-2e0d8a5b7c4f")
print(result.data)

Async client:

from claix import AsyncClaixClient

async with AsyncClaixClient() as client:
    doc = await client.extract.pdf("invoice.pdf", schema_id="...")
    answers = await client.context.ask(doc.document_id, ["What is the total?"])

5. Method map (OpenAPI 1.8.2)

SDK methodHTTP
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.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.spaces.create(name)POST /create-space
client.spaces.ask(space_id, questions)POST /space-context/{id}
client.spaces.delete(space_id)DELETE /delete-space/{id}
client.schemas.list()GET /api/schemas
client.schemas.create(...)POST /api/create-schema
client.schemas.delete(schema_id)POST /api/delete-schema

ia_response on document and space Q&A is list[str | None] so orchestrators can branch on deterministic null when evidence is missing.

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.extract.pdf("invoice.pdf", schema_id="3c7a9f21-4b8e-4d1a-9c6f-2e0d8a5b7c4f").data)
PY