# API Keys ## Create `client.inference.apiKeys.create(APIKeyCreateParamsbody?, RequestOptionsoptions?): APIKeyCreateResponse` **post** `/v2/gen-ai/models/api_keys` To create a model API key, send a POST request to `/v2/gen-ai/models/api_keys`. ### Parameters - `body: APIKeyCreateParams` - `name?: string` A human friendly name to identify the key ### Returns - `APIKeyCreateResponse` - `api_key_info?: APIModelAPIKeyInfo` Model API Key Info - `created_at?: string` Creation date - `created_by?: string` Created by - `deleted_at?: string` Deleted date - `name?: string` Name - `secret_key?: string` - `uuid?: string` Uuid ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const apiKey = await client.inference.apiKeys.create(); console.log(apiKey.api_key_info); ``` ## Update `client.inference.apiKeys.update(stringapiKeyUuid, APIKeyUpdateParamsbody?, RequestOptionsoptions?): APIKeyUpdateResponse` **put** `/v2/gen-ai/models/api_keys/{api_key_uuid}` To update a model API key, send a PUT request to `/v2/gen-ai/models/api_keys/{api_key_uuid}`. ### Parameters - `apiKeyUuid: string` - `body: APIKeyUpdateParams` - `api_key_uuid?: string` API key ID - `name?: string` Name ### Returns - `APIKeyUpdateResponse` - `api_key_info?: APIModelAPIKeyInfo` Model API Key Info - `created_at?: string` Creation date - `created_by?: string` Created by - `deleted_at?: string` Deleted date - `name?: string` Name - `secret_key?: string` - `uuid?: string` Uuid ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const apiKey = await client.inference.apiKeys.update('"123e4567-e89b-12d3-a456-426614174000"'); console.log(apiKey.api_key_info); ``` ## List `client.inference.apiKeys.list(APIKeyListParamsquery?, RequestOptionsoptions?): APIKeyListResponse` **get** `/v2/gen-ai/models/api_keys` To list all model API keys, send a GET request to `/v2/gen-ai/models/api_keys`. ### Parameters - `query: APIKeyListParams` - `page?: number` Page number. - `per_page?: number` Items per page. ### Returns - `APIKeyListResponse` - `api_key_infos?: Array` Api key infos - `created_at?: string` Creation date - `created_by?: string` Created by - `deleted_at?: string` Deleted date - `name?: string` Name - `secret_key?: string` - `uuid?: string` Uuid - `links?: APILinks` Links to other pages - `pages?: Pages` Information about how to reach other pages - `first?: string` First page - `last?: string` Last page - `next?: string` Next page - `previous?: string` Previous page - `meta?: APIMeta` Meta information about the data set - `page?: number` The current page - `pages?: number` Total number of pages - `total?: number` Total amount of items over all pages ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const apiKeys = await client.inference.apiKeys.list(); console.log(apiKeys.api_key_infos); ``` ## Delete `client.inference.apiKeys.delete(stringapiKeyUuid, RequestOptionsoptions?): APIKeyDeleteResponse` **delete** `/v2/gen-ai/models/api_keys/{api_key_uuid}` To delete an API key for a model, send a DELETE request to `/v2/gen-ai/models/api_keys/{api_key_uuid}`. ### Parameters - `apiKeyUuid: string` ### Returns - `APIKeyDeleteResponse` - `api_key_info?: APIModelAPIKeyInfo` Model API Key Info - `created_at?: string` Creation date - `created_by?: string` Created by - `deleted_at?: string` Deleted date - `name?: string` Name - `secret_key?: string` - `uuid?: string` Uuid ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const apiKey = await client.inference.apiKeys.delete('"123e4567-e89b-12d3-a456-426614174000"'); console.log(apiKey.api_key_info); ``` ## Update Regenerate `client.inference.apiKeys.updateRegenerate(stringapiKeyUuid, RequestOptionsoptions?): APIKeyUpdateRegenerateResponse` **put** `/v2/gen-ai/models/api_keys/{api_key_uuid}/regenerate` To regenerate a model API key, send a PUT request to `/v2/gen-ai/models/api_keys/{api_key_uuid}/regenerate`. ### Parameters - `apiKeyUuid: string` ### Returns - `APIKeyUpdateRegenerateResponse` - `api_key_info?: APIModelAPIKeyInfo` Model API Key Info - `created_at?: string` Creation date - `created_by?: string` Created by - `deleted_at?: string` Deleted date - `name?: string` Name - `secret_key?: string` - `uuid?: string` Uuid ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const response = await client.inference.apiKeys.updateRegenerate('"123e4567-e89b-12d3-a456-426614174000"'); console.log(response.api_key_info); ``` ## Domain Types ### API Model API Key Info - `APIModelAPIKeyInfo` Model API Key Info - `created_at?: string` Creation date - `created_by?: string` Created by - `deleted_at?: string` Deleted date - `name?: string` Name - `secret_key?: string` - `uuid?: string` Uuid