{
  "schemaVersion": 1,
  "operationId": "20260817085721-40cce6096a",
  "checkedAt": "2026-08-17T09:07:31.600Z",
  "testBoundary": {
    "authenticatedApiCalls": 0,
    "tokenizerCalls": 0,
    "modelCalls": 0,
    "graderCalls": 0,
    "weightsDownloaded": false,
    "sourcesStored": "receipts and hashes only; response bodies omitted",
    "purpose": "Verify public GLM-5.2 token-control contracts, a portable fail-closed validator, and bias arithmetic without claiming hosted route acceptance, tokenizer mappings, output guarantees, or model quality."
  },
  "sourceReceipts": {
    "chatCompletion": {
      "url": "https://docs.z.ai/api-reference/llm/chat-completion.md",
      "finalUrl": "https://docs.z.ai/api-reference/llm/chat-completion.md",
      "status": 200,
      "bytes": 42731,
      "sha256": "322c87b850c4504873b8c225b5b31266d90aa129f362134fa040c49c5943a7c9",
      "optional": false
    },
    "modelGuide": {
      "url": "https://docs.z.ai/guides/llm/glm-5.2.md",
      "finalUrl": "https://docs.z.ai/guides/llm/glm-5.2.md",
      "status": 200,
      "bytes": 25293,
      "sha256": "eeca971119068b0619137ce9c9d3c9362131baf16fdab0c067eefe5802919023",
      "optional": false
    },
    "modelApi": {
      "url": "https://huggingface.co/api/models/zai-org/GLM-5.2",
      "finalUrl": "https://huggingface.co/api/models/zai-org/GLM-5.2",
      "status": 200,
      "bytes": 23604,
      "sha256": "74995e388217febd71ac765920bed32fa47248a409bc455756ef118574297322",
      "optional": false
    },
    "pinnedConfig": {
      "url": "https://huggingface.co/zai-org/GLM-5.2/resolve/b4734de4facf877f85769a911abafc5283eab3d9/config.json",
      "finalUrl": "https://huggingface.co/api/resolve-cache/models/zai-org/GLM-5.2/b4734de4facf877f85769a911abafc5283eab3d9/config.json?%2Fzai-org%2FGLM-5.2%2Fresolve%2Fb4734de4facf877f85769a911abafc5283eab3d9%2Fconfig.json=&etag=%22f8b342fa9e8fecdc667312641760b4a3015b5e4f%22",
      "status": 200,
      "bytes": 3732,
      "sha256": "185f93ee6d12548e16a847e279dc0c3c90b1524c970b0866b42fb545747d859a",
      "optional": false
    },
    "pinnedGenerationConfig": {
      "url": "https://huggingface.co/zai-org/GLM-5.2/resolve/b4734de4facf877f85769a911abafc5283eab3d9/generation_config.json",
      "finalUrl": "https://huggingface.co/api/resolve-cache/models/zai-org/GLM-5.2/b4734de4facf877f85769a911abafc5283eab3d9/generation_config.json?%2Fzai-org%2FGLM-5.2%2Fresolve%2Fb4734de4facf877f85769a911abafc5283eab3d9%2Fgeneration_config.json=&etag=%22216bbb092d0df0dda1dc4cedd789b92286c4c001%22",
      "status": 200,
      "bytes": 194,
      "sha256": "ac76b43d8683d3b930126870fc8be73d8679308fe752fa1f381096d8354f6a55",
      "optional": false
    },
    "pinnedReadme": {
      "url": "https://huggingface.co/zai-org/GLM-5.2/resolve/b4734de4facf877f85769a911abafc5283eab3d9/README.md",
      "finalUrl": "https://huggingface.co/api/resolve-cache/models/zai-org/GLM-5.2/b4734de4facf877f85769a911abafc5283eab3d9/README.md?%2Fzai-org%2FGLM-5.2%2Fresolve%2Fb4734de4facf877f85769a911abafc5283eab3d9%2FREADME.md=&etag=%224245dd1dded39efdc83b5d38354ffc1b14f1879c%22",
      "status": 200,
      "bytes": 10905,
      "sha256": "ed5aca8ce3dc5f8de626c87e488444343e43b1dcbdeb0e643dc72fea63ab06e8",
      "optional": false
    },
    "transformersConfig": {
      "url": "https://raw.githubusercontent.com/huggingface/transformers/v5.12.0/src/transformers/generation/configuration_utils.py",
      "finalUrl": "https://raw.githubusercontent.com/huggingface/transformers/v5.12.0/src/transformers/generation/configuration_utils.py",
      "status": 200,
      "bytes": 97025,
      "sha256": "5feaa3dd36a0f9096a0c92dcc8394db73a9d5e86bc21eeaaed69290cb6650e44",
      "optional": false
    },
    "transformersProcessors": {
      "url": "https://raw.githubusercontent.com/huggingface/transformers/v5.12.0/src/transformers/generation/logits_process.py",
      "finalUrl": "https://raw.githubusercontent.com/huggingface/transformers/v5.12.0/src/transformers/generation/logits_process.py",
      "status": 200,
      "bytes": 150114,
      "sha256": "3aefb9fd5d35a2efb37c2bde596b0a2c55ab1bfa82b55de2df2b16062b3eb957",
      "optional": false
    },
    "vllmChatProtocol": {
      "url": "https://raw.githubusercontent.com/vllm-project/vllm/v0.27.1/vllm/entrypoints/openai/chat_completion/protocol.py",
      "finalUrl": "https://raw.githubusercontent.com/vllm-project/vllm/v0.27.1/vllm/entrypoints/openai/chat_completion/protocol.py",
      "status": 200,
      "bytes": 47397,
      "sha256": "69ca76724ccb4a2e990814767c344226d47ead7d608213a4939584cd048637dd",
      "optional": false
    },
    "vllmSamplingParams": {
      "url": "https://raw.githubusercontent.com/vllm-project/vllm/v0.27.1/vllm/sampling_params.py",
      "finalUrl": "https://raw.githubusercontent.com/vllm-project/vllm/v0.27.1/vllm/sampling_params.py",
      "status": 200,
      "bytes": 48261,
      "sha256": "cc040f9b21e373be3fa5f47c0f3a50e77229dede20cae6a8019f2b7f5ce365cf",
      "optional": false
    },
    "sglangOpenAIProtocol": {
      "url": "https://raw.githubusercontent.com/sgl-project/sglang/v0.5.17/python/sglang/srt/entrypoints/openai/protocol.py",
      "finalUrl": "https://raw.githubusercontent.com/sgl-project/sglang/v0.5.17/python/sglang/srt/entrypoints/openai/protocol.py",
      "status": 200,
      "bytes": 64259,
      "sha256": "6e2eb171d146e438c9af7641f44dd3dede4d0fa51f75f7a81d716cc988b91779",
      "optional": false
    },
    "sglangSamplingParams": {
      "url": "https://raw.githubusercontent.com/sgl-project/sglang/v0.5.17/python/sglang/srt/sampling/sampling_params.py",
      "finalUrl": "https://raw.githubusercontent.com/sgl-project/sglang/v0.5.17/python/sglang/srt/sampling/sampling_params.py",
      "status": 200,
      "bytes": 13031,
      "sha256": "9437125033cd7abe001689cef162ba558454fb455f577e7b36b4eaa4d3f95c24",
      "optional": false
    },
    "glm52Blog": {
      "url": "https://z.ai/blog/glm-5.2",
      "finalUrl": "https://z.ai/blog/glm-5.2",
      "status": 200,
      "bytes": 598,
      "sha256": "63e94b9e11a2db64243ff18418011577f2a98ca7851ce9dcb0e97cfe34cc245a",
      "optional": false
    },
    "zhipuResearch": {
      "url": "http://zhipuai.cn/zh/research",
      "finalUrl": "https://www.zhipuai.cn/zh/research",
      "status": 200,
      "bytes": 1236461,
      "sha256": "188772a5cb6b65eb65f02024d89d153b692ef3d3cb2c98ddd233352c0dd6ac80",
      "optional": true
    }
  },
  "pinnedModel": {
    "repository": "zai-org/GLM-5.2",
    "revision": "b4734de4facf877f85769a911abafc5283eab3d9",
    "vocabSize": 154880,
    "eosTokenIds": [
      154820,
      154827,
      154829
    ],
    "padTokenId": 154820
  },
  "findings": {
    "zai": {
      "documentedLogitBias": false,
      "documentedSequenceBias": false,
      "documentedSuppressTokens": false,
      "documentedAllowedTokenIds": false,
      "knownTemperatureMentions": 13,
      "knownTopPMentions": 4
    },
    "transformers": {
      "version": "v5.12.0",
      "directLogitBiasField": false,
      "sequenceBiasField": true,
      "suppressTokensField": true,
      "beginSuppressTokensField": true,
      "badWordsIdsField": true,
      "renormalizeLogitsField": true
    },
    "vllm": {
      "version": "v0.27.1",
      "chatLogitBias": true,
      "chatAllowedTokenIds": true,
      "numericStringKeysConverted": true,
      "biasClampedToOpenAIRange": true
    },
    "sglang": {
      "version": "v0.5.17",
      "openAILogitBias": true,
      "tokenIdKeysCheckedAgainstVocab": true,
      "auditedAllowedTokenIdsField": false
    }
  },
  "contracts": {
    "portableBiasRange": [
      -100,
      100
    ],
    "specialTokenDefault": "reject pad and EOS token IDs unless an explicit review enables them",
    "routeMatrix": [
      {
        "route": "Z.AI Chat Completion",
        "softTokenBias": "not documented",
        "sequenceBias": "not documented",
        "hardTokenMask": "not documented"
      },
      {
        "route": "Transformers 5.12",
        "softTokenBias": "sequence_bias with one-token tuples",
        "sequenceBias": "sequence_bias",
        "hardTokenMask": "suppress_tokens; custom processor for allow-only"
      },
      {
        "route": "vLLM 0.27.1 OpenAI chat",
        "softTokenBias": "logit_bias",
        "sequenceBias": "not equivalent",
        "hardTokenMask": "allowed_token_ids extension"
      },
      {
        "route": "SGLang 0.5.17 OpenAI chat",
        "softTokenBias": "logit_bias",
        "sequenceBias": "not equivalent",
        "hardTokenMask": "not in the audited protocol field set"
      }
    ]
  },
  "fixtures": [
    {
      "id": "zai-bias-undocumented",
      "input": {
        "route": "zai",
        "mode": "token-bias",
        "token_ids": [
          42
        ],
        "bias": 2
      },
      "expected": {
        "status": "unsupported",
        "code": "hosted-field-undocumented"
      },
      "actual": {
        "status": "unsupported",
        "code": "hosted-field-undocumented",
        "reason": "The audited Z.AI Chat Completion schema publishes no token-bias or token-mask field."
      }
    },
    {
      "id": "zai-allow-undocumented",
      "input": {
        "route": "zai",
        "mode": "allow-only",
        "token_ids": [
          42,
          43
        ]
      },
      "expected": {
        "status": "unsupported",
        "code": "hosted-field-undocumented"
      },
      "actual": {
        "status": "unsupported",
        "code": "hosted-field-undocumented",
        "reason": "The audited Z.AI Chat Completion schema publishes no token-bias or token-mask field."
      }
    },
    {
      "id": "transformers-single-token-bias",
      "input": {
        "route": "transformers",
        "mode": "token-bias",
        "token_ids": [
          42
        ],
        "bias": 2
      },
      "expected": {
        "status": "supported"
      },
      "actual": {
        "status": "supported",
        "request": {
          "sequence_bias": [
            {
              "token_ids": [
                42
              ],
              "bias": 2
            }
          ],
          "renormalize_logits": true
        }
      }
    },
    {
      "id": "transformers-sequence-bias",
      "input": {
        "route": "transformers",
        "mode": "sequence-bias",
        "token_ids": [
          42,
          43
        ],
        "bias": 3
      },
      "expected": {
        "status": "supported"
      },
      "actual": {
        "status": "supported",
        "request": {
          "sequence_bias": [
            {
              "token_ids": [
                42,
                43
              ],
              "bias": 3
            }
          ],
          "renormalize_logits": true
        }
      }
    },
    {
      "id": "transformers-suppress",
      "input": {
        "route": "transformers",
        "mode": "suppress",
        "token_ids": [
          42
        ]
      },
      "expected": {
        "status": "supported"
      },
      "actual": {
        "status": "supported",
        "request": {
          "suppress_tokens": [
            42
          ],
          "renormalize_logits": true
        }
      }
    },
    {
      "id": "transformers-allow-needs-custom-processor",
      "input": {
        "route": "transformers",
        "mode": "allow-only",
        "token_ids": [
          42
        ]
      },
      "expected": {
        "status": "unsupported",
        "code": "custom-allowlist-required"
      },
      "actual": {
        "status": "unsupported",
        "code": "custom-allowlist-required",
        "reason": "The audited GenerationConfig has no direct allowed_token_ids field."
      }
    },
    {
      "id": "vllm-token-bias",
      "input": {
        "route": "vllm",
        "mode": "token-bias",
        "token_ids": [
          42,
          43
        ],
        "bias": -4
      },
      "expected": {
        "status": "supported"
      },
      "actual": {
        "status": "supported",
        "request": {
          "logit_bias": {
            "42": -4,
            "43": -4
          }
        }
      }
    },
    {
      "id": "vllm-sequence-not-equivalent",
      "input": {
        "route": "vllm",
        "mode": "sequence-bias",
        "token_ids": [
          42,
          43
        ],
        "bias": 3
      },
      "expected": {
        "status": "unsupported",
        "code": "per-token-field-not-sequence-field"
      },
      "actual": {
        "status": "unsupported",
        "code": "per-token-field-not-sequence-field",
        "reason": "Use a reviewed engine-native constraint instead of translating this mode into ordinary logit_bias."
      }
    },
    {
      "id": "vllm-allow-only",
      "input": {
        "route": "vllm",
        "mode": "allow-only",
        "token_ids": [
          42,
          43
        ]
      },
      "expected": {
        "status": "supported"
      },
      "actual": {
        "status": "supported",
        "request": {
          "allowed_token_ids": [
            42,
            43
          ]
        }
      }
    },
    {
      "id": "vllm-bias-not-hard-ban",
      "input": {
        "route": "vllm",
        "mode": "suppress",
        "token_ids": [
          42
        ]
      },
      "expected": {
        "status": "unsupported",
        "code": "bias-is-not-a-hard-ban"
      },
      "actual": {
        "status": "unsupported",
        "code": "bias-is-not-a-hard-ban",
        "reason": "Use a reviewed engine-native constraint instead of translating this mode into ordinary logit_bias."
      }
    },
    {
      "id": "sglang-token-bias",
      "input": {
        "route": "sglang",
        "mode": "token-bias",
        "token_ids": [
          42
        ],
        "bias": 5
      },
      "expected": {
        "status": "supported"
      },
      "actual": {
        "status": "supported",
        "request": {
          "logit_bias": {
            "42": 5
          }
        }
      }
    },
    {
      "id": "sglang-sequence-not-equivalent",
      "input": {
        "route": "sglang",
        "mode": "sequence-bias",
        "token_ids": [
          42,
          43
        ],
        "bias": 2
      },
      "expected": {
        "status": "unsupported",
        "code": "per-token-field-not-sequence-field"
      },
      "actual": {
        "status": "unsupported",
        "code": "per-token-field-not-sequence-field",
        "reason": "The audited SGLang OpenAI contract exposes per-token logit_bias, not this portable hard constraint."
      }
    },
    {
      "id": "sglang-allow-not-in-audited-contract",
      "input": {
        "route": "sglang",
        "mode": "allow-only",
        "token_ids": [
          42
        ]
      },
      "expected": {
        "status": "unsupported",
        "code": "audited-sglang-field-is-logit-bias-only"
      },
      "actual": {
        "status": "unsupported",
        "code": "audited-sglang-field-is-logit-bias-only",
        "reason": "The audited SGLang OpenAI contract exposes per-token logit_bias, not this portable hard constraint."
      }
    },
    {
      "id": "negative-token-id",
      "input": {
        "route": "vllm",
        "mode": "token-bias",
        "token_ids": [
          -1
        ],
        "bias": 2
      },
      "expected": {
        "status": "rejected",
        "code": "token-id-out-of-range"
      },
      "actual": {
        "status": "rejected",
        "code": "token-id-out-of-range",
        "reason": "token id -1 is outside 0..154879"
      }
    },
    {
      "id": "token-id-at-vocab-size",
      "input": {
        "route": "sglang",
        "mode": "token-bias",
        "token_ids": [
          154880
        ],
        "bias": 2
      },
      "expected": {
        "status": "rejected",
        "code": "token-id-out-of-range"
      },
      "actual": {
        "status": "rejected",
        "code": "token-id-out-of-range",
        "reason": "token id 154880 is outside 0..154879"
      }
    },
    {
      "id": "string-token-id",
      "input": {
        "route": "vllm",
        "mode": "token-bias",
        "token_ids": [
          "42"
        ],
        "bias": 2
      },
      "expected": {
        "status": "rejected",
        "code": "invalid-token-id-type"
      },
      "actual": {
        "status": "rejected",
        "code": "invalid-token-id-type",
        "reason": "token id \"42\" is not an integer"
      }
    },
    {
      "id": "duplicate-token-id",
      "input": {
        "route": "transformers",
        "mode": "suppress",
        "token_ids": [
          42,
          42
        ]
      },
      "expected": {
        "status": "rejected",
        "code": "duplicate-token-id"
      },
      "actual": {
        "status": "rejected",
        "code": "duplicate-token-id",
        "reason": "token_ids must be unique"
      }
    },
    {
      "id": "special-token-default-block",
      "input": {
        "route": "vllm",
        "mode": "token-bias",
        "token_ids": [
          154820
        ],
        "bias": -5
      },
      "expected": {
        "status": "rejected",
        "code": "special-token-blocked"
      },
      "actual": {
        "status": "rejected",
        "code": "special-token-blocked",
        "reason": "token id 154820 is a pinned pad or EOS token"
      }
    },
    {
      "id": "special-token-explicit-review",
      "input": {
        "route": "vllm",
        "mode": "token-bias",
        "token_ids": [
          154820
        ],
        "bias": -5,
        "allow_special_tokens": true
      },
      "expected": {
        "status": "supported"
      },
      "actual": {
        "status": "supported",
        "request": {
          "logit_bias": {
            "154820": -5
          }
        }
      }
    },
    {
      "id": "bias-over-portable-range",
      "input": {
        "route": "vllm",
        "mode": "token-bias",
        "token_ids": [
          42
        ],
        "bias": 101
      },
      "expected": {
        "status": "rejected",
        "code": "bias-out-of-portable-range"
      },
      "actual": {
        "status": "rejected",
        "code": "bias-out-of-portable-range",
        "reason": "portable bias must remain inside -100..100"
      }
    },
    {
      "id": "bias-string",
      "input": {
        "route": "sglang",
        "mode": "token-bias",
        "token_ids": [
          42
        ],
        "bias": "2"
      },
      "expected": {
        "status": "rejected",
        "code": "invalid-bias-type"
      },
      "actual": {
        "status": "rejected",
        "code": "invalid-bias-type",
        "reason": "bias must be a finite number"
      }
    },
    {
      "id": "empty-token-set",
      "input": {
        "route": "transformers",
        "mode": "suppress",
        "token_ids": []
      },
      "expected": {
        "status": "rejected",
        "code": "empty-token-set"
      },
      "actual": {
        "status": "rejected",
        "code": "empty-token-set",
        "reason": "token_ids must be a non-empty array"
      }
    }
  ],
  "probabilityExamples": [
    {
      "id": "equal-logits-plus-two",
      "baseProbability": 0.5,
      "bias": 2,
      "oddsMultiplier": 7.38905609893065,
      "adjustedProbability": 0.8807970779778824
    },
    {
      "id": "equal-logits-minus-two",
      "baseProbability": 0.5,
      "bias": -2,
      "oddsMultiplier": 0.1353352832366127,
      "adjustedProbability": 0.11920292202211755
    },
    {
      "id": "high-base-minus-two",
      "baseProbability": 0.9,
      "bias": -2,
      "oddsMultiplier": 0.1353352832366127,
      "adjustedProbability": 0.5491469396207163
    },
    {
      "id": "very-high-base-minus-five",
      "baseProbability": 0.99,
      "bias": -5,
      "oddsMultiplier": 0.006737946999085467,
      "adjustedProbability": 0.40014039818696506
    }
  ],
  "assertions": [
    {
      "id": "required-sources-http-200",
      "pass": true
    },
    {
      "id": "pinned-model-revision",
      "pass": true
    },
    {
      "id": "pinned-vocab-size",
      "pass": true
    },
    {
      "id": "pinned-special-token-ids",
      "pass": true
    },
    {
      "id": "zai-known-fields-present",
      "pass": true
    },
    {
      "id": "zai-token-control-fields-absent",
      "pass": true
    },
    {
      "id": "transformers-native-controls",
      "pass": true
    },
    {
      "id": "vllm-openai-fields",
      "pass": true
    },
    {
      "id": "vllm-bias-clamp",
      "pass": true
    },
    {
      "id": "sglang-openai-field",
      "pass": true
    },
    {
      "id": "sglang-vocab-bound",
      "pass": true
    },
    {
      "id": "fixture-expectations",
      "pass": true
    },
    {
      "id": "plus-two-probability",
      "pass": true
    },
    {
      "id": "minus-two-does-not-ban-high-base",
      "pass": true
    }
  ],
  "summary": {
    "sourceCount": 14,
    "fixtureCount": 22,
    "assertionCount": 14,
    "passedAssertions": 14
  }
}
