CogniChem Python Client
Official Python SDK for the CogniChem compute API (/api/v1).
Installation
pip install cognichem-client
Requires Python 3.10+.
Quick start
from cognichem_client import CogniChem
client = CogniChem(api_key="YOUR_API_KEY")
# or: CogniChem.from_env() # reads COGNICHEM_API_KEY / COGNICHEM_BASE_URL
# Short utility
result = client.utils.run(
"convert",
{
"input_data": "CCO",
"input_format": "smiles",
"output_format": "pdbblock",
},
)
print(result.data)
# Long-running job: submit → wait → download
submitted = client.jobs.submit(
job_name="my-padel-run",
job_type="padel-descriptor",
payload={
"input_data": ["CCO", "CCC"],
"input_format": "smiles",
"descriptor_types": ["ALOGP", "AtomCount"],
},
)
status = client.jobs.wait(submitted.process_id) # completed | error | cancelled
if status.status == "completed":
artifact = client.jobs.result(submitted.process_id, save_path="./")
print(artifact.filename)
Authentication
| Mode | How |
|---|---|
| API key (recommended for scripts) | CogniChem(api_key=...) → X-Api-Key header |
| JWT (API key management) | client.auth.login_email(email, password) then client.api_keys.* |
Environment variables:
COGNICHEM_API_KEYCOGNICHEM_ACCESS_TOKEN(optional Bearer)COGNICHEM_BASE_URL(defaulthttps://api.cognichem.com)
Create and manage keys in your CogniChem account. Collection endpoints under /auth/api-keys require JWT.
API surface
| Resource | Examples |
|---|---|
client.jobs |
submit, submit_many, wait, run, result, result_many, info, list, cancel, delete |
client.inference |
submit, submit_batch, wait, run, result, list, delete |
client.inference.models.mpnn |
public(), user(name=None), delete(name) |
client.utils |
submit, wait, run, result, list, delete |
client.usage |
limits(month=None) |
client.auth / client.api_keys |
login, check, refresh, logout; list/create/rotate/delete keys |
Optional idempotency_key= on mutating POSTs (jobs, inference, utils submit).
Async twin: AsyncCogniChem with the same method names (await client.jobs.run(...)).
Errors
API failures raise subclasses of CogniChemError parsed from RFC 7807 problem details (detail, title, status, type, request_id, errors on 422).
Polling helpers raise PollTimeoutError, ProcessFailedError, or ProcessCancelledError when appropriate.
Examples
See examples/ for scripts covering utilities, inference, and job submission.
Live OpenAPI docs: https://api.cognichem.com/docs
Development
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
ruff check src tests
mypy
pytest
python scripts/sync_routes.py
Migrating from 0.1.x
1.0 is a clean break. There is no compatibility shim for CogniChemClient / client.utility. See CHANGELOG.md.
License
Apache 2.0
Metadata
Release files for cognichem-client 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cognichem_client-1.0.0.tar.gz | 35.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cognichem_client-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.3 kB
Release files / cognichem_client-1.0.0.tar.gz
| Download URL | cognichem_client-1.0.0.tar.gz |
|---|---|
| Size | 35.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04d4237ea9cc8c7f9cc7b32179393cb80343a9c885382be4f2bbb0f800a49527
|
|
BLAKE2b-256 checksum How to use checksums |
7cbdfb55d4ef43eb8e28a3ee112b8ed541bcce3d937ef4a071e97e5f567f331c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / cognichem_client-1.0.0-py3-none-any.whl
| Download URL | cognichem_client-1.0.0-py3-none-any.whl |
|---|---|
| Size | 37.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
101617712f66c54a2e62e4dce7bfffe4d07dd98e20f93eea6d1aa63f40a9d427
|
|
BLAKE2b-256 checksum How to use checksums |
c306e0bdf5ba1628466523c14b06a894a913f29ada8fa6362a69a9a911eb147e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|