Cost & Yield Calculator API

The Cost & Yield Calculator API provides a way to calculate the effective raw cost and the yield threshold for adding CP testing. It is available at:

POST https://www.promptbox.cn/api/cp.php

Request Format

The API accepts a POST request with a JSON body containing the following fields:

Field Type Description Default
untestedDieCost number Cost of an untested die. 0
assemblyCost number Assembly and final test cost. 0
cpTestCost number Total CP test cost. 0
cpYield number CP yield in percent (e.g., 95 = 95%). 100
ateYield number ATE yield after CP in percent (e.g., 90 = 90%). 100

Example Request

{
  "untestedDieCost": 2.5,
  "assemblyCost": 1.2,
  "cpTestCost": 0.5,
  "cpYield": 95,
  "ateYield": 90
}

Response Format

The API responds with a JSON object containing the calculated results:

Field Type Description
rawCost number The effective cost per good die (rounded to 2 decimal places).
addCpThreshold number The ATE-only yield percentage threshold below which CP testing should be added (rounded up to the nearest 0.1%).

Example Successful Response

{
  "rawCost": 4.39,
  "addCpThreshold": 85.3
}

Error Responses

If the request is invalid, the API will return an error JSON object with a message.

Status Code Description Example
400 Invalid input (e.g., yields ≤ 0 or bad JSON).
{
  "error": "Yields must be greater than 0."
}
405 Invalid HTTP method (only POST is allowed).
{
  "error": "Only POST method is allowed."
}

Usage Notes