Python SDK
Official Claix Python client
Endpoint
pip install claix-aiclaix-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.
The same client is also available in TypeScript: npm install claix-ai, with tools for LangChain.js, CrewAI, and LlamaIndex.TS.
1. Source, package, and related docs
- GitHub · Gaelproodoos/claix-python — source, issues, and examples
- PyPI · claix-ai — installable package (import name: claix)
- TypeScript SDK — npm install claix-ai, the same call map
- npm · claix-ai — TypeScript SDK package
- GitHub · Gaelproodoos/claix-typescript — TypeScript SDK source
- OpenAPI spec — canonical HTTP contract the SDK wraps
- A2A Protocol — JSON-RPC agent surface if you are not using Python
- MCP server — IDE and automation clients without a Python process
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 method | HTTP |
|---|---|
| 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).