pydo.genai.create_openai_api_key()

Generated on 7 Jul 2026 from pydo version v0.39.0

Usage

client.genai.create_openai_api_key(
    body={
        "api_key": "\"sk-proj--123456789098765432123456789\"",
        "name": "\"Production Key\"",
    },
)
Returns JSONRaises HttpResponseError

Description

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

Parameters

api_key string optional

Example: "sk-proj--123456789098765432123456789"

OpenAI API key

name string optional

Example: "Production Key"

Name of the key

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "api_key": "\"sk-proj--123456789098765432123456789\"",
  "name": "\"Production Key\""
}

resp = client.genai.create_openai_api_key(body=req)

Response Example

Show Response Example
{
  "api_key_info": {
    "created_at": "2023-01-01T00:00:00Z",
    "created_by": "12345",
    "deleted_at": "2023-01-01T00:00:00Z",
    "models": [],
    "name": "example name",
    "updated_at": "2023-01-01T00:00:00Z",
    "uuid": "123e4567-e89b-12d3-a456-426614174000"
  }
}

More Information

See /v2/gen-ai/openai/keys in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.