falaw.base#
Core types: ToolSpec and ModelRecord.
These dataclasses are the single source of truth from which every external surface (Claude skill, MCP server, HTTP service, UI) is derived.
Module Attributes
Hex characters of the digest |
Functions
|
Short content digest naming the version of a committed data table. |
Classes
|
Quantitative cost of one fal call against this model. |
|
One entry in the fal model catalog. |
|
Single source of truth for a tool exposed by falaw. |
- class falaw.base.CostEstimate(*, kind, amount, currency='USD', notes='', source='approximate')[source]#
Bases:
objectQuantitative cost of one fal call against this model.
- kind#
How the price scales.
per_callis the simplest: constant per invocation regardless of size.per_secondapplies to video / TTS where output length matters.per_imagecovers batch image gen.per_megapixelcovers high-res image generation.per_tokencovers LLM-style endpoints.
- amount#
USD (or
currency) per unit defined bykind.
- currency#
ISO 4217 code.
"USD"is the only supported value today; the field exists so we can extend without a schema migration.
- notes#
Free-form caveats — “rounded up to next second”, etc.
- source#
How the estimate was obtained —
"docs","empirical","approximate". Lets us flag stale or unverified entries in audits.
- class falaw.base.ModelRecord(*, id, category, description='', aliases=(), quality_tier='', cost_hint='', cost_estimate=None, docs_url='', max_clip_seconds=None, single_character_recommended=False, supported_resolutions=(), default_negative_prompt='', max_prompt_chars=None, size_param='image_size', param_specs=<factory>)[source]#
Bases:
objectOne entry in the fal model catalog.
- default_negative_prompt: str#
Quality/realism negatives worth appending by default (e.g. to avoid the plastic-skin look). Empty when none.
- max_clip_seconds: float | None#
Practical max length of a single generated clip, in seconds (e.g. ~10 for Seedance). Drives the “this shot is too long, split it” warning.
- max_prompt_chars: int | None#
Hard cap on
promptlength, from the model’s OpenAPI schema. Calls over it fail at fal with an HTTP 422 after queueing; falaw raises first.
- param_specs: Mapping[str, Mapping[str, Any]]#
Discoverable per-model parameters that matter for choosing well, as
{name: {"enum": [...], "default": ...}}— e.g. Recraft’sstyle, whose photoreal default silently overrides a woodcut prompt. Seefalaw.model_params().
- single_character_recommended: bool#
True when the model handles a single character per shot far better than multiple interacting ones — drives the “two characters, consider shot/reverse-shot” warning.
- falaw.base.TABLE_VERSION_CHARS = 12#
Hex characters of the digest
data_table_version()returns.
- class falaw.base.ToolSpec(*, name, description, func, input_schema=<factory>, output_schema=<factory>, tags=(), examples=(), version='0.0.1')[source]#
Bases:
objectSingle source of truth for a tool exposed by falaw.
A ToolSpec is what the registry stores. Bridges read it to produce Claude-skill instructions, MCP tool descriptors, HTTP endpoints, etc.
- falaw.base.data_table_version(path)[source]#
Short content digest naming the version of a committed data table.
The one definition for every table falaw ships (
models.json,llm_rates.json), so afalaw.CostBasisstamped by one is comparable with a basis stamped by another.Deliberately the bytes, not a declared
versionfield: 0.0.46 moved every premium LLM row’s price tenfold without touching one, and that drift is exactly what a persisted quote must be able to detect. A digest cannot forget to be bumped.- Return type: