{
  "x402Version": 2,
  "id": 39311,
  "slug": "39311",
  "resource": "https://api.magentlab.com/api/calc/anion_gap",
  "description": "Serum anion gap from sodium, chloride, and bicarbonate, with or without potassium. formula=without_k or formula=with_k is required; magent does not pick one. Deterministic Emmett–Narins 1977 arithmetic with citation. Not a diagnosis, albumin-corrected gap (Figge/Fencl), or delta gap.",
  "type": "http",
  "serviceName": "magent",
  "resourceType": "Agent Service",
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "payTo": "0x836Be278f1739fB4308091cD1852F7971Bc19Ee2",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "5000",
      "amountUsd": 0.005,
      "maxTimeoutSeconds": 600
    }
  ],
  "outputSchema": {
    "properties": {
      "example": {
        "type": "object"
      },
      "type": {
        "type": "string"
      }
    },
    "required": [
      "type"
    ],
    "type": "object"
  },
  "extensions": {
    "bazaar": {
      "info": {
        "iconUrl": "https://api.magentlab.com/favicon.ico",
        "input": {
          "body": {
            "items": [
              {
                "bicarbonate_mmol_l": 24,
                "chloride_mmol_l": 104,
                "formula": "without_k",
                "potassium_mmol_l": 4,
                "sodium_mmol_l": 140
              },
              {
                "bicarbonate_mmol_l": 24,
                "chloride_mmol_l": 104,
                "formula": "without_k",
                "potassium_mmol_l": 4,
                "sodium_mmol_l": 140
              }
            ]
          },
          "method": "POST",
          "type": "http"
        },
        "output": {
          "example": {
            "count": 2,
            "items": [
              {
                "anion_gap_mmol_l": 12,
                "bicarbonate_mmol_l": 24,
                "chloride_mmol_l": 104,
                "citation": {
                  "authors": "Emmett M, Narins RG",
                  "doi": "10.1097/00005792-197701000-00002",
                  "id": "emmett-narins-1977",
                  "source": "Medicine (Baltimore). 1977;56(1):38-54",
                  "title": "Clinical use of the anion gap"
                },
                "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
                "formula": "without_k",
                "formula_expression": "anion_gap_mmol_l = sodium_mmol_l - chloride_mmol_l - bicarbonate_mmol_l",
                "sodium_mmol_l": 140
              },
              {
                "anion_gap_mmol_l": 12,
                "bicarbonate_mmol_l": 24,
                "chloride_mmol_l": 104,
                "citation": {
                  "authors": "Emmett M, Narins RG",
                  "doi": "10.1097/00005792-197701000-00002",
                  "id": "emmett-narins-1977",
                  "source": "Medicine (Baltimore). 1977;56(1):38-54",
                  "title": "Clinical use of the anion gap"
                },
                "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
                "formula": "without_k",
                "formula_expression": "anion_gap_mmol_l = sodium_mmol_l - chloride_mmol_l - bicarbonate_mmol_l",
                "sodium_mmol_l": 140
              }
            ],
            "path": "/api/calc/anion_gap"
          },
          "type": "json"
        }
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "input": {
            "additionalProperties": false,
            "properties": {
              "body": {
                "additionalProperties": false,
                "properties": {
                  "items": {
                    "items": {
                      "properties": {
                        "bicarbonate_mmol_l": {
                          "description": "Serum bicarbonate in mmol/L (2-45).",
                          "type": "number"
                        },
                        "chloride_mmol_l": {
                          "description": "Serum chloride in mmol/L (70-130).",
                          "type": "number"
                        },
                        "formula": {
                          "description": "without_k (Na - Cl - HCO3) or with_k (Na + K - Cl - HCO3). Required; magent does not pick one silently.",
                          "enum": [
                            "without_k",
                            "with_k"
                          ],
                          "type": "string"
                        },
                        "potassium_mmol_l": {
                          "description": "Serum potassium in mmol/L (1.5-8.0). Required when formula=with_k. Ignored when formula=without_k.",
                          "type": "number"
                        },
                        "sodium_mmol_l": {
                          "description": "Serum sodium in mmol/L (110-160).",
                          "type": "number"
                        }
                      },
                      "required": [
                        "sodium_mmol_l",
                        "chloride_mmol_l",
                        "bicarbonate_mmol_l",
                        "formula"
                      ],
                      "type": "object"
                    },
                    "maxItems": 25,
                    "minItems": 1,
                    "type": "array"
                  }
                },
                "required": [
                  "items"
                ],
                "type": "object"
              },
              "headers": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              "method": {
                "const": "POST",
                "type": "string"
              },
              "type": {
                "const": "http",
                "type": "string"
              }
            },
            "required": [
              "type",
              "method"
            ],
            "type": "object"
          },
          "output": {
            "properties": {
              "example": {
                "type": "object"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        },
        "required": [
          "input"
        ],
        "type": "object"
      }
    }
  },
  "tags": [
    "anion-gap",
    "electrolytes",
    "acid-base",
    "calculator",
    "bazaar"
  ],
  "sourceHost": "api.magentlab.com",
  "lastUpdated": "2026-10-12T23:40:59.085Z",
  "quality": {
    "calls30d": 5,
    "uniquePayers30d": 2,
    "lastCalledAt": "2026-10-12T23:40:58.924Z"
  },
  "metadata": {
    "serviceName": "magent",
    "extensions": {
      "bazaar": {
        "info": {
          "iconUrl": "https://api.magentlab.com/favicon.ico",
          "input": {
            "body": {
              "items": [
                {
                  "bicarbonate_mmol_l": 24,
                  "chloride_mmol_l": 104,
                  "formula": "without_k",
                  "potassium_mmol_l": 4,
                  "sodium_mmol_l": 140
                },
                {
                  "bicarbonate_mmol_l": 24,
                  "chloride_mmol_l": 104,
                  "formula": "without_k",
                  "potassium_mmol_l": 4,
                  "sodium_mmol_l": 140
                }
              ]
            },
            "method": "POST",
            "type": "http"
          },
          "output": {
            "example": {
              "count": 2,
              "items": [
                {
                  "anion_gap_mmol_l": 12,
                  "bicarbonate_mmol_l": 24,
                  "chloride_mmol_l": 104,
                  "citation": {
                    "authors": "Emmett M, Narins RG",
                    "doi": "10.1097/00005792-197701000-00002",
                    "id": "emmett-narins-1977",
                    "source": "Medicine (Baltimore). 1977;56(1):38-54",
                    "title": "Clinical use of the anion gap"
                  },
                  "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
                  "formula": "without_k",
                  "formula_expression": "anion_gap_mmol_l = sodium_mmol_l - chloride_mmol_l - bicarbonate_mmol_l",
                  "sodium_mmol_l": 140
                },
                {
                  "anion_gap_mmol_l": 12,
                  "bicarbonate_mmol_l": 24,
                  "chloride_mmol_l": 104,
                  "citation": {
                    "authors": "Emmett M, Narins RG",
                    "doi": "10.1097/00005792-197701000-00002",
                    "id": "emmett-narins-1977",
                    "source": "Medicine (Baltimore). 1977;56(1):38-54",
                    "title": "Clinical use of the anion gap"
                  },
                  "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
                  "formula": "without_k",
                  "formula_expression": "anion_gap_mmol_l = sodium_mmol_l - chloride_mmol_l - bicarbonate_mmol_l",
                  "sodium_mmol_l": 140
                }
              ],
              "path": "/api/calc/anion_gap"
            },
            "type": "json"
          }
        },
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "properties": {
            "input": {
              "additionalProperties": false,
              "properties": {
                "body": {
                  "additionalProperties": false,
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "bicarbonate_mmol_l": {
                            "description": "Serum bicarbonate in mmol/L (2-45).",
                            "type": "number"
                          },
                          "chloride_mmol_l": {
                            "description": "Serum chloride in mmol/L (70-130).",
                            "type": "number"
                          },
                          "formula": {
                            "description": "without_k (Na - Cl - HCO3) or with_k (Na + K - Cl - HCO3). Required; magent does not pick one silently.",
                            "enum": [
                              "without_k",
                              "with_k"
                            ],
                            "type": "string"
                          },
                          "potassium_mmol_l": {
                            "description": "Serum potassium in mmol/L (1.5-8.0). Required when formula=with_k. Ignored when formula=without_k.",
                            "type": "number"
                          },
                          "sodium_mmol_l": {
                            "description": "Serum sodium in mmol/L (110-160).",
                            "type": "number"
                          }
                        },
                        "required": [
                          "sodium_mmol_l",
                          "chloride_mmol_l",
                          "bicarbonate_mmol_l",
                          "formula"
                        ],
                        "type": "object"
                      },
                      "maxItems": 25,
                      "minItems": 1,
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                },
                "headers": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object"
                },
                "method": {
                  "const": "POST",
                  "type": "string"
                },
                "type": {
                  "const": "http",
                  "type": "string"
                }
              },
              "required": [
                "type",
                "method"
              ],
              "type": "object"
            },
            "output": {
              "properties": {
                "example": {
                  "type": "object"
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "type": "object"
            }
          },
          "required": [
            "input"
          ],
          "type": "object"
        }
      }
    }
  },
  "liveness": {
    "reliability": null
  },
  "verified": false,
  "featured": false,
  "provider": {
    "host": "api.magentlab.com",
    "manifest_name": "api.magentlab.com",
    "source": "cdp-mirror",
    "source_manifest_url": "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources",
    "submitted_at": "2026-10-14T01:15:01.050Z"
  },
  "exampleResponse": {
    "example": {},
    "type": "string"
  }
}