codecamp

OpenAI 创建外部存储配置

创建外部存储配置

post /organization/external_storage

注册一个由客户管理的外部存储配置。

请求体参数

内容类型:application/json

  • project_id: string

  • provider: Aws { bucket, role_arn, type } or Azure { account_name, container, resource_group, 3 more } or Gcp { bucket, type, workload_identity_pool_id, 2 more } or Oci { bucket, region, tenancy_ocid, type }

  • Aws object { bucket, role_arn, type }

  • bucket: string

  • role_arn: string

  • type: "aws" (default: "aws")

  • "aws"

  • Azure object { account_name, container, resource_group, 3 more }

  • account_name: string

  • container: string

  • resource_group: string

  • subscription_id: string

  • tenant_id: string

  • type: "azure" (default: "azure")

  • "azure"

  • Gcp object { bucket, type, workload_identity_pool_id, 2 more }

  • bucket: string

  • type: "gcp" (default: "gcp")

  • "gcp"

  • workload_identity_pool_id: string

  • workload_identity_project_number: string

  • workload_identity_provider_id: string

  • Oci object { bucket, region, tenancy_ocid, type }

  • bucket: string

  • region: string

  • tenancy_ocid: string

  • type: "oci" (default: "oci")

  • "oci"

返回值

  • ExternalStorageConfiguration object { id, created_at, geography, 4 more }

  • id: string

  • created_at: integer

format: unixtime

  • geography: string

  • object: "organization.external_storage" (default: "organization.external_storage")

  • "organization.external_storage"

  • project_id: string

  • provider: AwsExternalStorageProvider or AzureExternalStorageProvider or GcpExternalStorageProvider or OciExternalStorageProvider

  • AwsExternalStorageProvider object { account_id, bucket, external_id, 3 more }

  • account_id: string

  • bucket: string

  • external_id: string

  • region: string

  • role_arn: string

  • type: "aws" (default: "aws")

  • "aws"

  • AzureExternalStorageProvider object { account_name, container, region, 4 more }

  • account_name: string

  • container: string

  • region: string

  • resource_group: string

  • subscription_id: string

  • tenant_id: string

  • type: "azure" (default: "azure")

  • "azure"

  • GcpExternalStorageProvider object { audience, bucket, region, 4 more }

  • audience: string

  • bucket: string

  • region: string

  • type: "gcp" (default: "gcp")

  • "gcp"

  • workload_identity_pool_id: string

  • workload_identity_project_number: string

  • workload_identity_provider_id: string

  • OciExternalStorageProvider object { bucket, region, tenancy_ocid, type }

  • bucket: string

  • region: string

  • tenancy_ocid: string

  • type: "oci" (default: "oci")

  • "oci"

  • status: "pending" or "validated" or "degraded" or "unhealthy"

  • "pending"

  • "validated"

  • "degraded"

  • "unhealthy"

示例

示例说明:下列请求展示配置结构。项目ID、存储桶、角色ARN及其他云资源示例值应替换为实际配置;后面的四组示例分别对应四种云存储。

## 从环境变量读取组织管理员密钥;存储配置ID和云资源示例值需替换为实际值
curl https://api.openai.com/v1/organization/external_storage \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
    -d '{
          "project_id": "proj_123",
          "provider": {
            "bucket": "bucket",
            "role_arn": "role_arn",
            "type": "aws"
          }
        }'

200 — 示例

以下 JSON 示例展示接口返回字段。字段名、资源标识符和状态值按原文保留。

{
  "id": "id",
  "created_at": 0,
  "geography": "geography",
  "object": "organization.external_storage",
  "project_id": "project_id",
  "provider": {
    "account_id": "account_id",
    "bucket": "bucket",
    "external_id": "external_id",
    "region": "region",
    "role_arn": "role_arn",
    "type": "aws"
  },
  "status": "pending"
}

AWS S3

## 从环境变量读取组织管理员密钥;存储配置ID和云资源示例值需替换为实际值
curl -X POST https://api.openai.com/v1/organization/external_storage \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_abc123",
    "provider": {
      "type": "aws",
      "bucket": "customer-logs",
      "role_arn": "arn:aws:iam::123456789012:role/OpenAIExternalStorageRole"
    }
  }'

响应示例

{
  "object": "organization.external_storage",
  "id": "extstorage_abc123",
  "project_id": "proj_abc123",
  "provider": {
    "type": "aws",
    "account_id": "123456789012",
    "region": "us-east-1",
    "bucket": "customer-logs",
    "role_arn": "arn:aws:iam::123456789012:role/OpenAIExternalStorageRole",
    "external_id": "proj_abc123"
  },
  "geography": "US",
  "status": "pending",
  "created_at": 1711471533
}

Azure Blob 存储

## 从环境变量读取组织管理员密钥;存储配置ID和云资源示例值需替换为实际值
curl -X POST https://api.openai.com/v1/organization/external_storage \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_azure123",
    "provider": {
      "type": "azure",
      "tenant_id": "11111111-1111-1111-1111-111111111111",
      "subscription_id": "22222222-2222-2222-2222-222222222222",
      "resource_group": "customer-rg",
      "account_name": "customerstorage",
      "container": "openai-data"
    }
  }'

响应示例

{
  "object": "organization.external_storage",
  "id": "extstorage_azure123",
  "project_id": "proj_azure123",
  "provider": {
    "type": "azure",
    "tenant_id": "11111111-1111-1111-1111-111111111111",
    "subscription_id": "22222222-2222-2222-2222-222222222222",
    "resource_group": "customer-rg",
    "account_name": "customerstorage",
    "container": "openai-data",
    "region": "eastus"
  },
  "geography": "US",
  "status": "pending",
  "created_at": 1711471533
}

Google Cloud Storage

## 从环境变量读取组织管理员密钥;存储配置ID和云资源示例值需替换为实际值
curl -X POST https://api.openai.com/v1/organization/external_storage \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_gcp123",
    "provider": {
      "type": "gcp",
      "bucket": "customer-gcp-retention",
      "workload_identity_project_number": "123456789012",
      "workload_identity_pool_id": "customer-pool",
      "workload_identity_provider_id": "customer-provider"
    }
  }'

响应示例

{
  "object": "organization.external_storage",
  "id": "extstorage_gcp123",
  "project_id": "proj_gcp123",
  "provider": {
    "type": "gcp",
    "bucket": "customer-gcp-retention",
    "workload_identity_project_number": "123456789012",
    "workload_identity_pool_id": "customer-pool",
    "workload_identity_provider_id": "customer-provider",
    "region": "us-central1",
    "audience": "proj_gcp123"
  },
  "geography": "US",
  "status": "pending",
  "created_at": 1711471400
}

OCI 对象存储

## 从环境变量读取组织管理员密钥;存储配置ID和云资源示例值需替换为实际值
curl -X POST https://api.openai.com/v1/organization/external_storage \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_oci123",
    "provider": {
      "type": "oci",
      "tenancy_ocid": "ocid1.tenancy.oc1..example",
      "region": "us-ashburn-1",
      "bucket": "customer-oci-retention"
    }
  }'

响应示例

{
  "object": "organization.external_storage",
  "id": "extstorage_oci123",
  "project_id": "proj_oci123",
  "provider": {
    "type": "oci",
    "tenancy_ocid": "ocid1.tenancy.oc1..example",
    "region": "us-ashburn-1",
    "bucket": "customer-oci-retention"
  },
  "geography": "US",
  "status": "pending",
  "created_at": 1711471300
}
OpenAI 验证外部密钥配置
OpenAI 获取外部存储配置
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

其他能力与进阶指南

Embeddings 接口参考

审计日志接口参考

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }