> ## 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 开源模型的使用情况。

## 购买许可证

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

## 报告使用情况

在使用模型时，请确保报告你的使用情况：我们要求至少每月报告一次。你需要与我们创建一个工作区并生成一个 API 密钥。在该工作区中，你每月将收到我们的账单。以下示例在每次生成后报告使用情况，将 Krea 的份额作为 `amount_usd` 发送，但按月汇总费用后发送也是可以接受的。

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

<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}
  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>
