Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
/**
* DeFi display formatting — ported verbatim from the SperaxOS `defi-utils`.
* Output strings are intentionally stable: downstream snapshots depend on the
* exact formatting, so do not "improve" these.
*/
/**
* Format a USD value with a `$` currency symbol and 2 decimal places
* (e.g. `1234.5` → `"$1,234.50"`).
* @param {number} value
* @returns {string}
*/
export function fmtUsd(value) {
return value.toLocaleString('en-US', {
currency: 'USD',
maximumFractionDigits: 2,
minimumFractionDigits: 2,
style: 'currency',
});
}
/**
* Format a percentage value (e.g. `5.42` → `"5.42%"`).
* @param {number} value
* @returns {string}
*/
export function fmtPct(value) {
return `${value.toFixed(2)}%`;
}
/**
* Format a token amount with precision that scales to its magnitude: tiny
* values collapse to `"<0.0001"`, sub-1 values get 6 decimals, sub-1000 get 4,
* and larger values get grouped thousands with ≤2 decimals.
* @param {number} value
* @returns {string}
*/
export function fmtAmount(value) {
if (value === 0) return '0';
if (value < 0.0001) return '<0.0001';
if (value < 1) return value.toFixed(6);
if (value < 1000) return value.toFixed(4);
return value.toLocaleString('en-US', { maximumFractionDigits: 2 });
}