CLI + SDK for the Cogitan Surrogates API — on-demand physics-simulation surrogate models.
Project description
cogitan
CLI + Python SDK for the Cogitan Surrogates API — call on-demand physics-simulation surrogate models (heat, water, contaminant transport, materials, …) over HTTP. No models or GPUs on your machine: you send inputs, the server runs the surrogate, you get results in ms.
Install
pip install cogitan
This gives you both the cogitan command and the import cogitan SDK.
Set up your key (once)
cogitan login
# Paste your Cogitan API key: cog_sk_********
# ✓ Saved to ~/.cogitan/config.json
Your key is stored in ~/.cogitan/config.json (locked to your user) and used automatically
forever. Key resolution order, first match wins:
--api-keyflag (one-off)COGITAN_API_KEYenv var (CI / containers)~/.cogitan/config.json(the normal case)
To point at a non-default endpoint (e.g. local testing): cogitan login --base-url http://localhost:8000,
or set COGITAN_BASE_URL.
Commands
| Command | What it does |
|---|---|
cogitan login |
Save your API key (prompts; persists forever) |
cogitan logout |
Delete the saved key |
cogitan whoami |
Show the active key (masked), endpoint, connection status |
cogitan models |
List the catalog of available models |
cogitan describe <model> |
Show a model's input schema (what fields to send) |
cogitan run <model> |
Run a prediction (see below) |
cogitan usage |
Current billing-period usage |
cogitan config |
Show config file location + settings |
cogitan version |
Print the version |
Add --help to any command for details.
Running models on your own inputs
Three ways to provide inputs — mix and match:
1. From a JSON file:
cogitan run thermal --in my_case.json --out result.json
my_case.json:
{
"grid_size": 64,
"conductivity": 50,
"sources": [{"x": 0.5, "y": 0.5, "amplitude": 30000, "width": 0.08}],
"boundary": {"left": {"type": "dirichlet", "value": 300}, "right": {"type": "dirichlet", "value": 350}}
}
2. Inline params (repeatable; values are JSON-parsed, so numbers/lists/objects work):
cogitan run thermal -p conductivity=50 -p grid_size=64
3. Piped from stdin:
cat my_case.json | cogitan run thermal
echo '{"conductivity": 50}' | cogitan run thermal --out result.json
Not sure what a model wants? cogitan describe thermal prints its input schema.
Without --out, the result prints to stdout (pipe it into jq, etc.).
Python SDK
import cogitan
client = cogitan.Client() # key from config/env automatically
print(client.models()) # ["thermal", "groundwater", "contaminant", "mlip", ...]
# run a model
result = client.run("thermal", {
"conductivity": 50,
"sources": [{"x": 0.5, "y": 0.5, "amplitude": 30000, "width": 0.08}],
"boundary": {"left": {"type": "dirichlet", "value": 300}},
})
print(result["max_temperature"])
# namespaced sugar
result = client.thermal.predict(conductivity=50, sources=[...])
# one-liner with the default client
result = cogitan.run("thermal", {"conductivity": 50})
Errors raise cogitan.APIError (with .status_code, .code, .request_id) or
cogitan.NotConfigured if no key is set.
Local development
pip install -e . # from this directory
COGITAN_BASE_URL=http://localhost:8000 cogitan models
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cogitan-0.1.0.tar.gz.
File metadata
- Download URL: cogitan-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71a1b443d464e3b79c311cea487e3e43038fdbee990f26b61ac94a1a5b1e8770
|
|
| MD5 |
a7df24f58cd22f17ea4c40ba6acdc37d
|
|
| BLAKE2b-256 |
50d3f22b4f3dd267d6b8df4c80a768385fcab55ca51e9f20c80f4327772844cc
|
File details
Details for the file cogitan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cogitan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d74ceff8f2a9c1d6913db659f37345101f6565b3ac4e40d2d3c4dc592b15b55a
|
|
| MD5 |
bddbf7ce42d222c3ae233b0c7c65af45
|
|
| BLAKE2b-256 |
cdbf018922caa3ec0b8547dd87d28c799c8af6f810e5e25c78b6325c39c582a7
|