---
title: "Create OpenAI API Key"
method: POST
path: "/v2/gen-ai/openai/keys"
tags: ["DigitalOcean-public.v2-new_GradientAI Platform"]
---

# Create OpenAI API Key

`POST /v2/gen-ai/openai/keys`

To create an OpenAI API key, send a POST request to `/v2/gen-ai/openai/keys`.

## Request body

- ApiCreateOpenAIAPIKeyInputPublic — CreateOpenAIAPIKeyInputPublic is used to create a new OpenAI API key for a specific agent.
  - `api_key` string — OpenAI API key
  - `name` string — Name of the key

## Response `200`

A successful response.

- ApiCreateOpenAIAPIKeyOutput — CreateOpenAIAPIKeyOutput is used to return the newly created OpenAI API key.
  - `api_key_info` ApiOpenAIAPIKeyInfo — OpenAI API Key Info
    - `created_at` string, date-time — Key creation date
    - `created_by` string, uint64 — Created by user id from DO
    - `deleted_at` string, date-time — Key deleted date
    - `models` ApiModel[] — Models supported by the openAI api key
      - `agreement` ApiAgreement — Agreement Description
        - `description` string
        - `name` string
        - `url` string
        - `uuid` string
      - `created_at` string, date-time — Creation date / time
      - `inference_name` string — Internally used name
      - `inference_version` string — Internally used version
      - `is_foundational` boolean — True if it is a foundational model provided by do
      - `metadata` object — Additional meta data
      - `name` string — Name of the model
      - `parent_uuid` string — Unique id of the model, this model is based on
      - `provider` 'MODEL_PROVIDER_DIGITALOCEAN' | 'MODEL_PROVIDER_ANTHROPIC' | 'MODEL_PROVIDER_OPENAI'
      - `updated_at` string, date-time — Last modified
      - `upload_complete` boolean — Model has been fully uploaded
      - `url` string — Download url
      - `usecases` ApiModelUsecase[] — Usecases of the model
      - `uuid` string — Unique id
      - `version` ApiModelVersion — Version Information about a Model
        - `major` integer — Major version number
        - `minor` integer — Minor version number
        - `patch` integer — Patch version number
    - `name` string — Name
    - `updated_at` string, date-time — Key last updated date
    - `uuid` string — Uuid

## Other responses

- `401` — Authentication failed due to invalid credentials.
- `404` — The resource was not found.
- `429` — The API rate limit has been exceeded.
- `500` — There was a server error.
- `default` — There was an unexpected error.

## Changes

- **2025-10-16** `cb3bf9b21459` — 2 info
  - api tag `DigitalOcean-public.v2-new_GradientAI Platform` added
  - api tag `GradientAI Platform` removed
- **2025-07-18** `f8e8c290636c` — 9 info
  - api operation id `create_openai_api_key` removed and replaced with `genai_create_openai_api_key`
  - the endpoint scheme security `bearer_auth` was added to the API
  - api tag `GradientAI Platform` added
  - api tag `GenAIAPI` removed
  - …5 more
- **2025-07-17** `5fc9af728e82` — 1 breaking, 3 warning, 8 info
  - request body became required
  - the optional response header `ratelimit-limit` removed for the status `200`
  - the optional response header `ratelimit-remaining` removed for the status `200`
  - the optional response header `ratelimit-reset` removed for the status `200`
  - …8 more
- **2025-07-17** `f8e8c290636c` — 9 info
  - api operation id `create_openai_api_key` removed and replaced with `genai_create_openai_api_key`
  - the endpoint scheme security `bearer_auth` was added to the API
  - api tag `GradientAI Platform` added
  - api tag `GenAIAPI` removed
  - …5 more

[Change history](https://skmtc.dev/digitalocean/apis/digitalocean-api/changes/v2/gen-ai/openai/keys/post.md)

---

[API](https://skmtc.dev/digitalocean/apis/digitalocean-api.md) · [All operations](https://skmtc.dev/digitalocean/apis/digitalocean-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/digitalocean/digitalocean-api/revisions/cb3bf9b21459/schema)
