BaseAiCore
Zero-dependency domain foundation: canonical model identity, machine profile, the Unsupported measurement sentinel, capability IDs, IDs, timestamps and the base error hierarchy.
Status: Phases 1–5 shipped (0.4.1) — the full development
plan: measurement, identity, IDs, time, hashing,
errors, money, cost, model descriptor, runtime profile, measurement subject, the machine profile
with its fingerprint, capability identifiers, an ordered DataClassification, and the optional
adapter axis on an execution subject. Every public type is exported from baseaicore.__init__ —
see the API reference.
Part of the Local AI Suite.
Install
pip install baseaicore
Quickstart
from baseaicore import ModelIdentity, ProviderKind, normalize_digest
identity = ModelIdentity(
ProviderKind.OLLAMA,
"qwen3.5:9b-q8_0",
normalize_digest("1f3a9c4e2b70a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f607182930"),
)
print(identity.canonical_id) # ollama/qwen3.5:9b-q8_0@sha256:1f3a9c4e2b70
print(identity.identity_confidence) # digest (IdentityConfidence.DIGEST)
A capability ID validates its own syntax and knows its place in the vocabulary's specialization tree — the vocabulary's contents belong to SetSpec, not here:
from baseaicore import CapabilityId
specific = CapabilityId("coding.python")
general = CapabilityId("coding")
print(specific.inherits_from(general)) # True — Python-coding evidence also satisfies "coding"
print(general.inherits_from(specific)) # False — the reverse does not hold
A measurement this machine cannot provide refuses to behave like a number, so the idiom that would fabricate one fails loudly instead of producing a plausible chart:
from baseaicore import UNSUPPORTED, is_supported, supported_values
try:
UNSUPPORTED or 0 # TypeError — an absent measurement is not 0, and refuses to become one
except TypeError as refusal:
print(refusal)
is_supported(UNSUPPORTED) # False
supported_values([12.5, UNSUPPORTED, 9.0]) # [12.5, 9.0], and you know two of three were real
The same rule governs money. A price is a dated, sourced observation with a validity window — not a property of the model — and a model with no price costs unknown, never nothing:
from baseaicore import (
ModelPricing,
Money,
PricingSource,
TokenRates,
TokenUsage,
estimate_cost,
utc_now,
)
pricing = ModelPricing(
identity=identity,
rates=TokenRates(
currency="USD",
input_per_million_tokens=Money.from_decimal("USD", "3.00"),
output_per_million_tokens=Money.from_decimal("USD", "15.00"),
),
source=PricingSource.PROVIDER_PUBLISHED,
observed_at=utc_now(),
)
usage = TokenUsage(
input_tokens=1_500_000, output_tokens=200_000, cache_write_tokens=0, cache_read_tokens=0
)
estimate = estimate_cost(usage, pricing, at=utc_now())
print(estimate.total) # 7.5 USD
print(estimate.pricing_hash) # which price produced that figure
Store the TokenUsage and the pricing_hash, not the money: when a provider changes its prices —
which it does on its own schedule, not yours — history re-costs from the counts instead of being
quietly wrong (ADR-0030).
See docs/packages/baseaicore/spec.md §7 for the full API and §20 for the acceptance criteria these examples come from.
Documentation
Project documentation lives under docs/. Start with docs/README.md.
| Read this | For |
|---|---|
| docs/quickstart.md | A guided walk through every public type, runnable top to bottom |
| docs/api.md | Every public symbol's docstring, generated by scripts/generate_api_reference.py |
| docs/packages/baseaicore/spec.md | Purpose, scope, non-goals, public contracts, configuration, acceptance criteria |
| docs/packages/baseaicore/development-plan.md | The phased build plan: goals, work, tests, acceptance criteria per phase |
Development
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install
pytest -m "not live and not performance"
See CONTRIBUTING.md for the full workflow and SECURITY.md for
how to report a vulnerability.
License
Apache-2.0 — see LICENSE.
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 baseaicore-0.4.2.tar.gz.
File metadata
- Download URL: baseaicore-0.4.2.tar.gz
- Upload date:
- Size: 181.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be055b82d8858189b032bc2e3de85a68b2ab35d6792481eebbc8817fe3e486d0
|
|
| MD5 |
d5ec65eb883ff3471e049134f7a41d16
|
|
| BLAKE2b-256 |
588d5d3122d1f3c2b361c6d521f23fc8e55b785c7b49b5cb07e5c7232b2bc889
|
Provenance
The following attestation bundles were made for baseaicore-0.4.2.tar.gz:
Publisher:
release.yml on JPKell/BaseAiCore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
baseaicore-0.4.2.tar.gz -
Subject digest:
be055b82d8858189b032bc2e3de85a68b2ab35d6792481eebbc8817fe3e486d0 - Sigstore transparency entry: 2732912266
- Sigstore integration time:
-
Permalink:
JPKell/BaseAiCore@8c04208c0828f12af0519c83b65881f30d067e9a -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/JPKell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c04208c0828f12af0519c83b65881f30d067e9a -
Trigger Event:
push
-
Statement type:
File details
Details for the file baseaicore-0.4.2-py3-none-any.whl.
File metadata
- Download URL: baseaicore-0.4.2-py3-none-any.whl
- Upload date:
- Size: 68.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4f82cdd698d85ca7e23dd175b1f6c61f9a38f5c9b194d0a308a5d38ff7c6110
|
|
| MD5 |
8a8cd718487c585101707177573fae07
|
|
| BLAKE2b-256 |
e9370db059a1ba505f8c9c933ecfe0fbd3849c7220776053b350ffacb5a5a0bc
|
Provenance
The following attestation bundles were made for baseaicore-0.4.2-py3-none-any.whl:
Publisher:
release.yml on JPKell/BaseAiCore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
baseaicore-0.4.2-py3-none-any.whl -
Subject digest:
c4f82cdd698d85ca7e23dd175b1f6c61f9a38f5c9b194d0a308a5d38ff7c6110 - Sigstore transparency entry: 2732912287
- Sigstore integration time:
-
Permalink:
JPKell/BaseAiCore@8c04208c0828f12af0519c83b65881f30d067e9a -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/JPKell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c04208c0828f12af0519c83b65881f30d067e9a -
Trigger Event:
push
-
Statement type: