# WritersLogic Chemical Formula Weight Calculator

> WritersLogic Chemical Formula Weight Calculator is a paid API for AI agents from agents.writerslogic.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-18).

Parses a chemical formula or validates SMILES syntax, returning the Hill-notation formula, molar mass in g/mol using CIAAW standard atomic weights, mass fractions, and optional molar mass verification

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/formula-weight?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-chemical-formula-weight-calculator-0751f3c4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8TghqdY0qk-TN15BujaC1

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability writerslogic-chemical-formula-weight-calculator-0751f3c4 -d '<json body>'
```

Example prompt: Can you calculate the formula weight of CuSO4·5H2O using CIAAW atomic weights and also check whether the stated molar mass of 249.69 g/mol is correct within a tolerance of 0.01 g/mol?

## When to prefer this

Choose this endpoint when you need a standards-compliant molar mass computed from CIAAW atomic weights with exact decimal arithmetic, especially for hydrates, coordination compounds, or ionic formulas. It is ideal for verifying a stated molecular weight against an authoritative source, or for canonicalizing a formula to Hill notation. Prefer it over general chemistry databases when you need a lightweight, deterministic computation without network lookups to external compound registries. Use SMILES mode specifically for grammar validation of SMILES strings, not for weight computation from SMILES.

## Known failure modes

- Unrecognized element symbol (case-sensitive) causes a parse error — CO is carbon monoxide, Co is cobalt
- Elements without a standard atomic weight (Tc, Pm, elements above Bi except Th, Pa, U) return unknown weight unless elementWeights is provided
- Formula exceeding 200 characters is rejected
- Invalid SMILES syntax in smiles mode returns a syntax error rather than a weight
- Isotope or deuterium notation in SMILES is not handled and may cause unexpected results
- Charge notation not properly formatted may cause parse ambiguity (trailing ^2+, 2-, bare +/- are ignored but other formats may not be)

## How this service works

Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.

## Output

Returns the Hill-notation canonical formula, the formula weight in g/mol computed with CIAAW abridged standard atomic weights using exact decimal arithmetic, and mass fractions for each element. If claimedWeight and tolerance are provided, also returns a boolean verdict on whether the stated weight is within tolerance. For SMILES mode, returns a syntax validity result without computing a weight. Elements lacking a standard atomic weight return 'unknown' unless elementWeights overrides are supplied.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "mode": {
   "enum": [
    "formula",
    "smiles"
   ],
   "type": "string",
   "description": "formula (default) computes the weight; smiles validates syntax only."
  },
  "smiles": {
   "type": "string",
   "maxLength": 200,
   "description": "A single SMILES string without a name, at most 200 characters (mode smiles)."
  },
  "formula": {
   "type": "string",
   "maxLength": 200,
   "description": "Chemical formula, at most 200 characters. Element symbols are case-sensitive (Co is cobalt, CO is carbon monoxide). Hydrate separators: . · • *. A trailing charge such as ^2+, 2- after a bracket, or a bare + or - is ignored."
  },
  "tolerance": {
   "type": "number",
   "maximum": 1000,
   "minimum": 0,
   "description": "Allowed absolute difference from claimedWeight in g/mol. Default 0.01."
  },
  "claimedWeight": {
   "type": "number",
   "maximum": 1000000000,
   "minimum": 0,
   "description": "Stated molar mass to check, g/mol."
  },
  "elementWeights": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "symbol",
     "weight"
    ],
    "properties": {
     "symbol": {
      "type": "string",
      "maxLength": 3,
      "description": "Element symbol."
     },
     "weight": {
      "type": "number",
      "maximum": 1000,
      "minimum": 0.0001,
      "description": "Atomic weight to use, g/mol."
     }
    }
   },
   "maxItems": 20,
   "description": "Caller-chosen weights; they take precedence over the table and are the only way to weigh elements without a standard atomic weight."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-chemical-formula-weight-calculator-0751f3c4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.writerslogic.com](https://www.zero.xyz/host/agents.writerslogic.com/llms.txt)
