Fast, typed Python tools for Chilean data and public APIs.
CL Forge combines Rust-backed validation utilities with a clean Python interface for the CMF and Mercado Público APIs. It includes synchronous and asynchronous clients, typed responses, configurable HTTP behavior, and flexible credential providers.
CL Forge supports Python 3.12–3.14.
pip install cl-forgeUsing uv:
uv add cl-forgefrom cl_forge import Ppu, calculate_verifier, validate_rut
validate_rut(12_345_678, "5") # True
calculate_verifier(12_345_678) # "5"
plate = Ppu("PHZF55")
plate.complete # "PHZF55-K"
plate.numeric # 69455from cl_forge import CmfClient
cmf = CmfClient("your-cmf-api-key")
latest_uf = cmf.uf.latest()
ipc_2025 = cmf.ipc.year(2025)
usd_for_day = cmf.usd.day(2025, 12, 1)The CMF client provides resources for ipc, uf, utm, usd, eur (also euro), tip, and tmc, plus raw JSON and XML access.
Note
CMF requests require an API key. You can request one through the CMF API portal.
from cl_forge import MarketClient
market = MarketClient("your-mercado-publico-ticket")
active_tenders = market.tender.active()
today_orders = market.order.today()
suppliers = market.supplier.search("70.017.820-K")The Mercado Público client includes typed resources for tenders, purchase orders, suppliers, and buyers, plus raw v1 and v2 access.
Note
Mercado Público requests require an API ticket. See the Mercado Público API portal for access details.
The asynchronous clients mirror the synchronous resource interface:
from cl_forge import AsyncCmfClient
cmf = AsyncCmfClient("your-cmf-api-key")
latest_uf = await cmf.uf.latest()Pass a credential directly, load it from the environment, or read it from a dotenv file:
export CLFORGE_CMF_API_KEY="your-cmf-api-key"
export CLFORGE_MARKET_API_KEY="your-mercado-publico-ticket"from cl_forge import ClientConfig, CmfClient, DotEnvCredentials, EnvCredentials
cmf = CmfClient(
credentials=EnvCredentials(),
config=ClientConfig(timeout=20, http2=True, retries=5),
)
cmf_from_dotenv = CmfClient(DotEnvCredentials(".env"))| Area | Public API |
|---|---|
| CMF | CmfClient · AsyncCmfClient |
| Mercado Público | MarketClient · AsyncMarketClient |
| Credentials | EnvCredentials · DotEnvCredentials |
| HTTP configuration | ClientConfig |
| RUT/RUN | validate_rut · calculate_verifier |
| License plates | Ppu |
Explore the full documentation for installation details and the complete API reference.
Contributions are welcome. Please read the contributing guide before opening a pull request.
CL Forge is available under the Apache License 2.0.
