> ## Documentation Index
> Fetch the complete documentation index at: https://www.krea.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 企业版开源模型使用

> 购买 Krea 开源模型许可证，生成 API 密钥，并按月上报用量以进行企业计费。

## 购买许可证

请参阅我们的[开源定价](https://www.krea.ai/open-source-pricing)，了解如何购买开源模型许可证。当每月生成的图像超过 10,000 张时，我们要求购买企业版许可证。[联系销售](https://www.krea.ai/enterprise#contact)以获取访问权限。

<h2 id="reporting-usage">
  报告使用情况
</h2>

在使用模型时，请确保报告你的使用情况：我们要求至少每月报告一次。你需要与我们创建一个工作区并生成一个 API 密钥。请告知我们，以便我们为你的工作区完成开通。

上报的用量将按月计费到该工作区所选的计费账户。有关发票交付、付款条款以及在 Krea 中查看发票的位置，请参阅[后付费发票](/docs/cn/user-guide/help-and-support/postpaid-invoicing)。以下示例在每次生成后报告使用情况，将 Krea 的总份额作为 `amount_usd` 发送，但也可以将多次生成汇总后以任意频率上报。

可选的 `key` 字段是一个幂等性密钥：使用相同密钥的重试请求最多只会计费一次。

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch("https://api.krea.ai/oss/usage", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.KREA_API_TOKEN}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      amount_usd: 0.0045,     // 这些生成对应的 Krea 总份额
      model: "raw",
      generations: 1,
      key: "123456789ABCDEF"  // 可选的幂等性密钥
    }),
  });
  ```

  ```bash cURL theme={null}
  # `amount_usd`：这些生成对应的 Krea 总份额
  # `key`：可选的幂等性密钥
  curl -X POST https://api.krea.ai/oss/usage \
    -H "Authorization: Bearer $KREA_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "amount_usd": 0.0045,
      "model": "raw",
      "generations": 1,
      "key": "123456789ABCDEF"
    }'
  ```

  ```python Python theme={null}
  import os
  import requests

  API_TOKEN = os.environ["KREA_API_TOKEN"]

  response = requests.post(
      "https://api.krea.ai/oss/usage",
      headers={
          "Authorization": f"Bearer {API_TOKEN}",
          "Content-Type": "application/json",
      },
      json={
          "amount_usd": 0.0045,     # 这些生成对应的 Krea 总份额
          "model": "raw",
          "generations": 1,
          "key": "123456789ABCDEF"  # 可选的幂等性密钥
      },
  )
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.