Skip to main content

meterline-job

Part of meterline. meterline helps people who run or pay for AI tools in an organisation see and compare usage and cost across providers: it reads each provider's usage API and writes the data in one common record format.

Runs the meterline connectors you configure, copies their records into one silver folder, builds gold from it and publishes the result, as one command that a scheduler can run every day. It prints one JSON status line per step and exits with a code that says what kind of failure came first. Project terms such as silver and gold are defined in the glossary.

It keeps no key of its own: each connector reads its key from its documented environment variable, and gold reads its hashing key from METERLINE_GOLD_KEY. Python 3.10 or later; it needs meterline and meterline-gold, and each connector is an extra.

Status: tested against the connectors' fake APIs only. It is not a connector and does not run through the connector kit. See Known limits.

pip install "meterline-job[all]"
meterline-job check job.toml

From a clone of the repository (for the tests and development):

pip install -e packages/meterline -e "packages/meterline-job[dev]"

The command

meterline-job run CONFIG [--step NAME] [--no-retry]
meterline-job check CONFIG

run runs every connector in the order of the file, then silver, then gold. With --step it runs one step: a connector's name, silver or gold. With --no-retry a connector that fails transiently is not run again. check validates the file, the connector packages and the paths the file names, makes no network call and exits 0 or 2.

Extra Installs
anthropic meterline-anthropic
anthropic-admin meterline-anthropic-admin
litellm meterline-litellm
copilot meterline-copilot
all every connector in this table

A configured connector whose package is missing is an input error (exit 2) that names the extra to install.

The configuration

The file is TOML; job.example.toml shows every key. An unknown key is an input error. The keys of a [[connector]] table other than the ones below are the connector's own options and go to its run as they are.

Key Meaning
data_root, gold_root where each connector keeps its folder (<data_root>/<name>), and where the gold folders go: <gold_root>/builds/<YYYY-MM-DD> (UTC) and -2, -3 for a rerun, <gold_root>/frozen/ for closed months and <gold_root>/published for the folder to serve
[publish] freeze_after_days, freeze_cap_extra_days days after the end of a month before it is frozen (4) and extra days after which it is frozen whatever the sources say (10)
[gold] org, policy, prices the organisation files, the policy and the price list that gold needs
[gold] parquet write the Parquet twins of the CSV files; true by default
[gold] invoice the provider invoice to reconcile with; optional
[[connector]] name, kind, since a name (not silver, gold or publish), anthropic, anthropic_admin, litellm or copilot, and the first day of a backfill
[[connector]] retries, retry_wait_seconds how many times a transient failure is retried (1) and the wait in seconds (300)

What to serve. Only <gold_root>/published/, never builds/ or frozen/: the publish step freezes a closed month and delivers it once, and keeps the rest of the month in progress fresh. The operations page operate-daily.md says how and states the delivery rule.

Exit codes

The job exits with the worst step in the order 0 < 1 < 2 < 3 < 4. A scheduler alerts on a non-zero code, and a person acts on 2, 3 and 4.

Exit failure_kind Meaning
0 none Every step is done.
1 transient A connector failed and may work later, or a folder was locked by another run.
2 input The input is wrong: the file, a key, the state file, the data or gold's inputs.
3 permanent The provider refused the request.
4 build Gold's build failed an assertion, or failed in any way that is not a wrong input.

Code 4 exists only on the job's step lines and exit code. The connectors keep exit codes 0 to 3, and gold is never retried by the job.

Public interface

import meterline_job

code = meterline_job.run_job(meterline_job.load_config("job.toml"), step=None, no_retry=False)

run_job takes the parsed configuration and returns the exit code. For a test it also takes transports (a map from a connector's name to an httpx transport), now, sleep and out.

Known limits

Not proven.

  • It was built and tested against the connectors' fake APIs. Nothing here proves live authentication, live response shapes or rate limits.
  • A folder on a network file system is not tested.

Left open.

  • The silver step skips a connector whose folder is locked and exits 1, so a gold build after it lacks that connector's records.
  • Nothing deletes an old build: builds/ grows by one build per run, and frozen/ is kept. Delete old builds by hand (the build a frozen.json entry names may go too).
  • The erase tool is a later change; the manual procedure is in PRIVACY.md and the layout makes it possible without rotating the hashing key.
  • publish needs a POSIX system and exits 2 elsewhere.

Tests

python -m pytest -q packages/meterline-job/tests

The tests run the whole job against the connectors' public fake APIs and the simulator, so they need no key and no network.

Metadata

Release files for meterline-job 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meterline-job 0.1.0
File Size Uploaded Provenance Actions
meterline_job-0.1.0.tar.gz 48.6 kB With provenance Details for meterline_job-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meterline-job 0.1.0
File Interpreter ABI Platform Actions
meterline_job-0.1.0-py3-none-any.whl Python 3 none any Details for meterline_job-0.1.0-py3-none-any.whl

Total release size: 76.8 kB

Release files / meterline_job-0.1.0.tar.gz

Download URL meterline_job-0.1.0.tar.gz
Size 48.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6ba7ebdd8c006639b73fdc73d4d093c3a3eace1067fe07d588cf9b22be42d79e
BLAKE2b-256 checksum
How to use checksums
c4405b79174237818a90b5b79ca55563f5d7e08b23bae0204c8d0d826ab34746
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / meterline_job-0.1.0-py3-none-any.whl

Download URL meterline_job-0.1.0-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aef9c69b21365afa37aaf23b7a2ad6a78f729bd3250a892aa7f0345f44118f44
BLAKE2b-256 checksum
How to use checksums
51ec5da6e436c67158a0b0f3839377e3facd8a176f7d11bd23615342998d6717
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for meterline-job 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for meterline_job-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page