Skip to content
Fossa

Metadata

Document commitments, schemas, and validation.

Metadata contract

Provider, model, and list profiles store a document URI and SHA-256 hash. The hash covers the exact UTF-8 bytes, including whitespace and trailing newlines. The program stores the commitment; it does not parse JSON.

Schema v1 defines the application document format. Select #/$defs/provider for Provider, #/$defs/model for ModelMetadata, and #/$defs/list for ListMetadata. Validate the selected definition, not only the root union. Enable URI-format validation.

Documents describe identity and capabilities. On-chain offers set prices, capacity, checkpoints, modalities, and token limits. Lists set membership. A valid document does not prove a capability claim or endpoint availability.

Provider document

FieldRequirement
nameRequired. 1–256 Unicode characters; nonblank; no ASCII controls.
endpointRequired. Full HTTPS inference URL, at most 2,048 characters; no credentials, whitespace, or fragment.
imageOptional HTTPS image URL under the same URL rules. Omit or use null for no image.
requestLimitsOptional runtime admission policy. Require windowSeconds (1–86,400) and at least one positive limit (1–1,000,000): requestsPerWindow (provider total), concurrentRequests (active total), requestsPerIp, requestsPerWallet, concurrentPerIp, or concurrentPerWallet. Unknown policy fields are rejected.
schemaVersionOptional; must equal 1 when present.
$schemaOptional; must equal this version’s provider schema identifier.

Limits apply across this provider’s models. Request counts use per-identity fixed windows; concurrency covers active inference through cleanup. Omitted limits are unspecified. These are provider-enforced HTTP rules, independent of on-chain booking capacity. See request limits for restart, replica, retry, and identity boundaries.

The on-chain authority supplies the provider’s wallet identity. endpoint is the inference destination, not the metadata URI.

Model document

FieldRequirement
idRequired, 1–256 characters without whitespace or ASCII controls. Its exact UTF-8 SHA-256 must match the on-chain model ID.
nameRequired; same display-name rules as provider metadata.
aliasOfOptional direct canonical ID for a duplicate registration. Must differ from id.
checkpointsOptional { id, name, ordered?, textCounter? } entries with unique immutable IDs. Ordered entries run earliest to latest; ordered defaults to true.
modalitiesRequired input and output arrays, each with 1–8 unique names matching [a-z][a-z-]{0,31}.
contextTokens, outputTokensRequired positive integer limits.
inputBoundTokensOptional input bound; defaults to contextTokens.
capabilitiesOptional object requiring boolean tools and reasoning. When omitted, tools defaults to false and reasoning defaults to whether effort exists.
effortOptional ordered array of 1–7 unique labels: none, thinking, low, medium, high, xhigh, max.
variantsOptional request settings, requiring effort. IDs must match effort labels in the same order.
settingsOptional defaults object requiring maxTokens, temperature, and topP.
schemaVersion, $schemaOptional version 1 and exact model schema identifier.

Model metadata describes the family. Each on-chain offer declares the provider’s actual support and limits. Keep those differences when building a catalog. Metadata does not prove model execution.

Aliases resolve only to an existing direct canonical model with eligible offers. Unknown targets, chains, and cycles remain unavailable. A UC variant is a separate model, not an alias.

Checkpoint identities

Hash the exact UTF-8 checkpoint id with SHA-256. The result must match the offer’s checkpoint. Do not hash its display name or use a zero hash as a wildcard. Catalogs exclude offers with an undeclared checkpoint.

For image input, the model metadata authority adds the exact checkpoint ID and its positive per-image ceiling to the model document’s imageTokensByCheckpoint object. For example, {"example/model@v1": 1024} reserves 1,024 input tokens per image. Catalogs expose the selected entry as maxImageTokens on the offer. Choose an upper bound that providers serving that checkpoint can honor. Each attached image adds that amount to the input reservation. The encoded attachment still counts toward the upload limit. An image-capable offer must honor the published ceiling. If increasing it would invalidate outstanding bookings, use a new checkpoint or finish those bookings first. Providers report usage for settlement within the booked limits. Without a published ceiling, clients skip image bookings for that checkpoint. Text requests can still use it.

Use ordered: false when no release order is declared. Maintained clients treat it as the earliest published version without another picker choice. Each booking still requests the offer’s exact hash. Use Latest as the display name when no numbered release exists.

Onboarding defaults an omitted checkpoint to the first ordered ID, or the first ID when none are ordered. Updating metadata does not replace an existing offer’s checkpoint.

Exact text counting

A model listing’s authority can publish how to count a text chat for each checkpoint. Add textCounter with format set to huggingface-chat-v1, a public HTTPS url, and the lowercase sha256 of the file at that URL. Publish the updated model document through its existing on-chain URI and hash. Providers serving that checkpoint must use its prompt formatting.

The file is a UTF-8 JSON object with the complete Hugging Face tokenizer object, the effective Jinja chatTemplate, optional bos_token and eos_token strings, and 1–16 reference checks. Each check includes messages and the expected integer tokens from your serving stack. Include tool calls, chat history, and Unicode text when supported. The count includes the generation prompt. Disable tokenizer padding and truncation.

Run fossa metadata validate-counter FILE to check the examples and obtain the digest. Serve the exact bytes over public HTTPS on port 443, without redirects, up to 32 MiB. Allow cross-origin GET for browser clients. Use synthetic messages in examples. Publish a counter only when you can verify the serving configuration.

Clients download the file and count locally. They send its digest in x-fossa-text-counter with the inference request. The provider verifies the digest against the booked checkpoint and recounts before inference. Without a usable counter, clients reserve a conservative estimate. Image requests use the checkpoint’s published per-image allowance.

Variants and settings

Token limits range from 1 through 4,294,967,295. Require inputBoundTokens <= contextTokens and settings.maxTokens <= outputTokens.

Each variant requires reasoning_effort. It can also set temperature, top_p, presence_penalty, and frequency_penalty. Other body fields are rejected. Variant values override defaults. Without variants, effort labels are sent directly. A label such as thinking can map to reasoning_effort: high.

Temperature ranges from 0 to 2; top-p from 0 to 1; presence and frequency penalties from -2 to 2. Bounds are inclusive. Numeric spellings such as 100, 100.0, and 1e2 have equal value. These settings do not bypass request or token-limit validation.

Model names

Use UC instead of Uncensored in the display name of an uncensored model variant. For example, use Example Flash UC. Keep its canonical id unchanged, even when that ID contains uncensored.

Keep a UC variant separate from the original model. Providers can share one model ID while offering different checkpoints of that same model and variant. Publish those checkpoint identities in the model document; each offer selects one exact identity.

List document

List metadata is separate from membership and fee terms. Its profile account commits to these display fields:

FieldRequirement
nameRequired; same display-name rules as provider metadata.
accentColorRequired six-digit hexadecimal color, such as #8B7ACF.
imageOptional HTTPS profile-image URL.
websiteOptional HTTPS website URL.
iconOptional HTTPS URL for a white SVG icon.
schemaVersion, $schemaOptional version 1 and exact list schema identifier.

URLs accept at most 2,048 characters without credentials, whitespace, or fragments. Omit optional URLs or use null for no value. Unknown list-document fields are rejected.

Use a simple white icon on a transparent background. The maintained validator accepts an SVG namespace and viewBox, basic shapes, paths, and containers, up to 64 KiB. Paints may use white, #fff, #ffffff, or none, including inherited paints.

Scripts, styles, events, animation, references, gradients, text, embedded images, entities, document types, XML declarations, and CSS paints are rejected. This includes currentColor. Clients tint the verified icon with the list color.

Verify and index documents

  1. Validate the metadata account’s owner, generated discriminator, expected size, PDA, market, and parent binding. Read only uri_len URI bytes.
  2. Hash the exact document bytes before parsing or reformatting. Require the recorded SHA-256.
  3. Require a UTF-8 JSON object without a byte-order mark. Limit it to 32,768 bytes and 64 nested object or array levels, including the root. Reject unpaired surrogate escapes and nonfinite numbers.
  4. Validate the schema for that account kind, including URI formats. Do not coerce types or alter the published bytes.
  5. For models, enforce the two token-limit comparisons, unique variant IDs, and variant IDs matching effort labels in the same order. Hash the document’s id and compare it with the on-chain model ID.
  6. Apply omitted-field defaults only to the decoded representation. Cache by document kind and hash. Revalidate when the commitment changes.

Invalid or unavailable metadata must not become an eligible catalog entry. Retrieval and freshness are responsibilities of the consuming application; they do not change the on-chain commitment.

Change a published document

Publish the new document bytes, then use the recorded authority to update their hash and URI. Provider and model updates use their own authorities; list updates require the list authority. See metadata update instructions.

Changing hosted JSON without an on-chain update produces a hash mismatch. A stable URI can be reused, but every byte change still needs a new commitment. An immutable URI can identify each version separately. The program does not require either hosting choice.

Versioning and publishing

Missing schemaVersion means v1. New documents should include version 1 and their exact schema identifier. Explicit unsupported versions and mismatched schema identifiers are rejected. Incompatible rules require a new schema version and consumer support.

Provider and model documents permit unknown extension fields. Consumers ignore unsupported extensions while validating known fields. List documents reject unknown fields. Variant request bodies accept only the defined reasoning and sampling fields.

Shared conformance cases test independent validators. Each case supplies kind, expected valid, and either document or exact raw JSON. Use raw unchanged when present. Otherwise serialize the document to UTF-8 before validation.

The CLI metadata validator applies these rules to local files. Validation does not publish a document or update its on-chain reference.