# Consumer Center and Project Cost Permission Configuration

## Scenario 1: Sub-Account Views Company Consumption and Bills

**Applicable Scenario**: Finance staff need to reconcile company consumption, orders, and bills across projects.

**Permission Effect**: Can query the costs, orders, and bills under the current Company ID, and download the related data; can complete unpaid orders and initiate payment for unpaid orders.

> Note: Consumer Center authorization is not restricted by project scope. Grant it only to sub-accounts that need to view company-wide costs.

### Configure Consumer Center Page Access Permission

Access to the Consumer Center page is controlled by `uai_modelverse:CheckMenuConsumer`. The policy script in this scenario already includes this permission, so you only need to create and bind the policy as described below; no separate configuration is required. To control menu display separately, see [Page Access Permission Management](../page-access-permission.md).

### Create Project-Level Policy

1. In the Astraflow console, click **Account and Permission Management** in the account menu at the top right.
2. Go to **Access Control > Policy Management**, and click **Create Custom Policy**.
3. Enter `Astraflow-Billing-ReadOnly` as the policy name, and select **Project Level** for the policy level.
4. Select **Script Edit**, paste the following script, and save.

```plain
{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "label:ListLabelsByResourceIds"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    },
    {
      "Effect": "Allow",
      "Action": [
        "iam:ListUsers"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    },
    {
      "Effect": "Allow",
      "Action": [
        "uai_modelverse:CompleteUnpaidOrder",
        "uai_modelverse:DownloadBillSummary",
        "uai_modelverse:DownloadInvoice",
        "uai_modelverse:DownloadListBills",
        "uai_modelverse:DownloadListPaidBills",
        "uai_modelverse:DownloadListPaidOrders",
        "uai_modelverse:DownloadListUnpaidBills",
        "uai_modelverse:DownloadListUnpaidOrders",
        "uai_modelverse:DownloadOrderSummary",
        "uai_modelverse:DownloadTxBillSummary",
        "uai_modelverse:DownloadTxInvoice",
        "uai_modelverse:DownloadTxListBills",
        "uai_modelverse:DownloadTxListPaidBills",
        "uai_modelverse:DownloadTxListUnpaidBills",
        "uai_modelverse:GetCostOverview",
        "uai_modelverse:GetCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetFilterOptions",
        "uai_modelverse:GetModelVerseCostAnalysis",
        "uai_modelverse:GetMonthlyAmount",
        "uai_modelverse:GetMonthlyPaidBill",
        "uai_modelverse:GetOrderAmount",
        "uai_modelverse:GetSandboxCostAnalysis",
        "uai_modelverse:GetTxCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetTxMonthlyAmount",
        "uai_modelverse:GetTxMonthlyPaidBill",
        "uai_modelverse:GetTxMonthlyUnpaidBill",
        "uai_modelverse:GetUserBillingByKey",
        "uai_modelverse:ListPaidBills",
        "uai_modelverse:ListPaidOrderSummary",
        "uai_modelverse:ListPaidOrders",
        "uai_modelverse:ListTxPaidBills",
        "uai_modelverse:ListTxUnpaidBills",
        "uai_modelverse:ListUnpaidBills",
        "uai_modelverse:ListUnpaidOrderSummary",
        "uai_modelverse:ListUnpaidOrders",
        "uai_modelverse:StartPayUnpaidOrders",
        "uai_modelverse:CheckMenuConsumer"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    }
  ]
}
```

### Bind Policy to Sub-Account

1. Go to **Access Control > User Management**, and click **Add Permission** in the operation column of the target sub-account.
2. Bind the policy `Astraflow-Billing-ReadOnly`, specify the projects to authorize, and save.
3. The sub-account enters **Consumer Center** to query company consumption, orders, and bills.

## Scenario 2: Sub-Account Views the Cost of the Entire Project

**Applicable Scenario**: The project owner needs to view the overall cost of the current project, as well as the cost of API Keys they created or that are shared with them.

**Permission Effect**: Can enter the Project Cost page and query both the "All" and "My" data scopes of the project; no permission to query costs at the Company ID level is granted.

> Note: This policy explicitly denies all Consumer Center interfaces and its menu. When bound together with Scenario 1 or Scenario 4, Consumer Center cannot be accessed. To view both Consumer Center and all project costs, bind only the policy in Scenario 4.

### Create Project-Level Policy

1. In the Astraflow console, click **Account and Permission Management** in the account menu at the top right.
2. Go to **Access Control > Policy Management**, and click **Create Custom Policy**.
3. Enter `Astraflow-ProjectCost-All` as the policy name, and select **Project Level** for the policy level.
4. Select **Script Edit**, paste the following script, and save.

```plain
{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "uai_modelverse:CheckMenuProjectCost",
        "uai_modelverse:DownloadUMInferExportTask",
        "uai_modelverse:GetBillProjectCostFilter",
        "uai_modelverse:GetBillProjectCostModelVerse",
        "uai_modelverse:GetBillProjectCostOverview",
        "uai_modelverse:GetBillProjectCostSandbox",
        "uai_modelverse:GetBillUserCostFilter",
        "uai_modelverse:GetBillUserCostModelVerse",
        "uai_modelverse:ListBillProjectCostDetail",
        "uai_modelverse:ListBillUserCostDetail",
        "uai_modelverse:ListUMInferExportTasks",
        "uai_modelverse:RestartUMInferExportTask"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    },
    {
      "Effect": "Deny",
      "Action": [
        "uai_modelverse:CompleteUnpaidOrder",
        "uai_modelverse:DownloadBillSummary",
        "uai_modelverse:DownloadInvoice",
        "uai_modelverse:DownloadListBills",
        "uai_modelverse:DownloadListPaidBills",
        "uai_modelverse:DownloadListPaidOrders",
        "uai_modelverse:DownloadListUnpaidBills",
        "uai_modelverse:DownloadListUnpaidOrders",
        "uai_modelverse:DownloadOrderSummary",
        "uai_modelverse:DownloadTxBillSummary",
        "uai_modelverse:DownloadTxInvoice",
        "uai_modelverse:DownloadTxListBills",
        "uai_modelverse:DownloadTxListPaidBills",
        "uai_modelverse:DownloadTxListUnpaidBills",
        "uai_modelverse:GetCostOverview",
        "uai_modelverse:GetCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetFilterOptions",
        "uai_modelverse:GetModelVerseCostAnalysis",
        "uai_modelverse:GetMonthlyAmount",
        "uai_modelverse:GetMonthlyPaidBill",
        "uai_modelverse:GetOrderAmount",
        "uai_modelverse:GetSandboxCostAnalysis",
        "uai_modelverse:GetTxCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetTxMonthlyAmount",
        "uai_modelverse:GetTxMonthlyPaidBill",
        "uai_modelverse:GetTxMonthlyUnpaidBill",
        "uai_modelverse:GetUserBillingByKey",
        "uai_modelverse:ListPaidBills",
        "uai_modelverse:ListPaidOrderSummary",
        "uai_modelverse:ListPaidOrders",
        "uai_modelverse:ListTxPaidBills",
        "uai_modelverse:ListTxUnpaidBills",
        "uai_modelverse:ListUnpaidBills",
        "uai_modelverse:ListUnpaidOrderSummary",
        "uai_modelverse:ListUnpaidOrders",
        "uai_modelverse:StartPayUnpaidOrders",
        "uai_modelverse:CheckMenuConsumer"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    }
  ]
}
```

### Bind Policy to Sub-Account

1. Go to **Access Control > User Management**, and click **Add Permission** in the operation column of the target sub-account.
2. Select `Astraflow-ProjectCost-All`, specify the projects to authorize, and save.
3. The sub-account enters the **Project Cost** page of the corresponding project and uses the data scope option to query "All" or "My" costs.

## Scenario 3: Sub-Account Views Only "My" Costs Under the Project

**Applicable Scenario**: Project members or external collaborators only need to view the cost of API Keys they created or that are shared with them, and should not view the overall project cost or other members' data.

**Permission Effect**: Can enter the Project Cost page and query only "My" model service costs and details; cannot query the cost of other API Keys in the project.

> Note: This policy explicitly denies all Consumer Center interfaces and its menu. When bound together with Scenario 1 or Scenario 4, Consumer Center cannot be accessed.

### Create Project-Level Policy

1. In the Astraflow console, click **Account and Permission Management** in the account menu at the top right.
2. Go to **Access Control > Policy Management**, and click **Create Custom Policy**.
3. Enter `Astraflow-ProjectCost-OwnAndShared` as the policy name, and select **Project Level** for the policy level.
4. Select **Script Edit**, paste the following script, and save.

```plain
{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "uai_modelverse:CheckMenuProjectCost",
        "uai_modelverse:DownloadUMInferUserExportTask",
        "uai_modelverse:GetBillUserCostFilter",
        "uai_modelverse:GetBillUserCostModelVerse",
        "uai_modelverse:ListBillUserCostDetail",
        "uai_modelverse:ListUMInferExportUserTasks",
        "uai_modelverse:RestartUMInferUserExportTask"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    },
    {
      "Effect": "Deny",
      "Action": [
        "uai_modelverse:CheckMenuConsumer",
        "uai_modelverse:CompleteUnpaidOrder",
        "uai_modelverse:DownloadBillSummary",
        "uai_modelverse:DownloadInvoice",
        "uai_modelverse:DownloadListBills",
        "uai_modelverse:DownloadListPaidBills",
        "uai_modelverse:DownloadListPaidOrders",
        "uai_modelverse:DownloadListUnpaidBills",
        "uai_modelverse:DownloadListUnpaidOrders",
        "uai_modelverse:DownloadOrderSummary",
        "uai_modelverse:DownloadTxBillSummary",
        "uai_modelverse:DownloadTxInvoice",
        "uai_modelverse:DownloadTxListBills",
        "uai_modelverse:DownloadTxListPaidBills",
        "uai_modelverse:DownloadTxListUnpaidBills",
        "uai_modelverse:DownloadUMInferExportTask",
        "uai_modelverse:GetBillProjectCostFilter",
        "uai_modelverse:GetBillProjectCostModelVerse",
        "uai_modelverse:GetBillProjectCostOverview",
        "uai_modelverse:GetBillProjectCostSandbox",
        "uai_modelverse:GetCostOverview",
        "uai_modelverse:GetCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetFilterOptions",
        "uai_modelverse:GetModelVerseCostAnalysis",
        "uai_modelverse:GetMonthlyAmount",
        "uai_modelverse:GetMonthlyPaidBill",
        "uai_modelverse:GetOrderAmount",
        "uai_modelverse:GetSandboxCostAnalysis",
        "uai_modelverse:GetTxCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetTxMonthlyAmount",
        "uai_modelverse:GetTxMonthlyPaidBill",
        "uai_modelverse:GetTxMonthlyUnpaidBill",
        "uai_modelverse:GetUserBillingByKey",
        "uai_modelverse:ListBillProjectCostDetail",
        "uai_modelverse:ListPaidBills",
        "uai_modelverse:ListPaidOrderSummary",
        "uai_modelverse:ListPaidOrders",
        "uai_modelverse:ListTxPaidBills",
        "uai_modelverse:ListTxUnpaidBills",
        "uai_modelverse:ListUMInferExportTasks",
        "uai_modelverse:ListUnpaidBills",
        "uai_modelverse:ListUnpaidOrderSummary",
        "uai_modelverse:ListUnpaidOrders",
        "uai_modelverse:RestartUMInferExportTask",
        "uai_modelverse:StartPayUnpaidOrders"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    }
  ]
}
```

### Bind Policy to Sub-Account

1. Go to **Access Control > User Management**, and click **Add Permission** in the operation column of the target sub-account.
2. Select `Astraflow-ProjectCost-OwnAndShared`, specify the projects to authorize, and save.
3. The sub-account enters the **Project Cost** page of the corresponding project to view "My" cost data.

## Scenario 4: Sub-Account Views Both Company Consumption and All Project Costs

**Applicable Scenario**: The user needs to track both overall company consumption and bills, and the cost breakdown of specific projects. Typical users are finance leads, BU leads, or project owners responsible for multiple projects.

**Permission Effect**: Can enter Consumer Center to query the costs, orders, and bills under the Company ID; can also enter Project Cost to view the cost overview, model service costs, sandbox costs, and details of authorized projects. The two data scopes are independent and do not restrict each other. Completing unpaid orders and initiating payment for unpaid orders are not included.

### Create Project-Level Policy

1. In the Astraflow console, click **Account and Permission Management** in the account menu at the top right.
2. Go to **Access Control > Policy Management**, and click **Create Custom Policy**.
3. Enter `Astraflow-BillingAndProjectCost-ReadOnly` as the policy name, and select **Project Level** for the policy level.
4. Select **Script Edit**, paste the following script, and save.

```plain
{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "uai_modelverse:CheckMenuConsumer",
        "uai_modelverse:CheckMenuProjectCost",
        "uai_modelverse:DownloadBillSummary",
        "uai_modelverse:DownloadInvoice",
        "uai_modelverse:DownloadListBills",
        "uai_modelverse:DownloadListPaidBills",
        "uai_modelverse:DownloadListPaidOrders",
        "uai_modelverse:DownloadListUnpaidBills",
        "uai_modelverse:DownloadListUnpaidOrders",
        "uai_modelverse:DownloadOrderSummary",
        "uai_modelverse:DownloadTxBillSummary",
        "uai_modelverse:DownloadTxInvoice",
        "uai_modelverse:DownloadTxListBills",
        "uai_modelverse:DownloadTxListPaidBills",
        "uai_modelverse:DownloadTxListUnpaidBills",
        "uai_modelverse:DownloadUMInferExportTask",
        "uai_modelverse:DownloadUMInferUserExportTask",
        "uai_modelverse:GetBillProjectCostFilter",
        "uai_modelverse:GetBillProjectCostModelVerse",
        "uai_modelverse:GetBillProjectCostOverview",
        "uai_modelverse:GetBillProjectCostSandbox",
        "uai_modelverse:GetBillUserCostFilter",
        "uai_modelverse:GetBillUserCostModelVerse",
        "uai_modelverse:GetCostOverview",
        "uai_modelverse:GetCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetFilterOptions",
        "uai_modelverse:GetModelVerseCostAnalysis",
        "uai_modelverse:GetMonthlyAmount",
        "uai_modelverse:GetMonthlyPaidBill",
        "uai_modelverse:GetOrderAmount",
        "uai_modelverse:GetSandboxCostAnalysis",
        "uai_modelverse:GetTxCurrentMonthlyUnpaidBill",
        "uai_modelverse:GetTxMonthlyAmount",
        "uai_modelverse:GetTxMonthlyPaidBill",
        "uai_modelverse:GetTxMonthlyUnpaidBill",
        "uai_modelverse:GetUserBillingByKey",
        "uai_modelverse:ListBillProjectCostDetail",
        "uai_modelverse:ListBillUserCostDetail",
        "uai_modelverse:ListPaidBills",
        "uai_modelverse:ListPaidOrderSummary",
        "uai_modelverse:ListPaidOrders",
        "uai_modelverse:ListTxPaidBills",
        "uai_modelverse:ListTxUnpaidBills",
        "uai_modelverse:ListUMInferExportTasks",
        "uai_modelverse:ListUMInferExportUserTasks",
        "uai_modelverse:ListUnpaidBills",
        "uai_modelverse:ListUnpaidOrderSummary",
        "uai_modelverse:ListUnpaidOrders",
        "uai_modelverse:RestartUMInferExportTask",
        "uai_modelverse:RestartUMInferUserExportTask"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {}
    }
  ]
}
```

### Bind Policy to Sub-Account

1. Go to **Access Control > User Management**, and click **Add Permission** in the operation column of the target sub-account.
2. Select `Astraflow-BillingAndProjectCost-ReadOnly`, specify the projects to authorize, and save.
3. The sub-account views company consumption and bills in **Consumer Center**, and views "All" and "My" costs on the **Project Cost** page of authorized projects.
