get_api_key: Get API key from R environment variable.

View source: R/api_key_functions.R

get_api_keyR Documentation

Get API key from R environment variable.

Description

Get API key from R environment variable.

Usage

get_api_key(env_var = "CHATGPT_KEY")

Arguments

env_var

Character string indicating the name of the temporary R environment variable with the API key and the used AI model. Currently, the argument only takes env_var = "CHATGPT_KEY". See set_api_key() to set/create this variable.

Details

get_api_key() can be used after executing set_api_key() or by adding the api key permanently to your R environment by using usethis::edit_r_environ(). Then write ⁠CHATGPT_KEY=[insert your api key here]⁠ and close the .Renviron window and restart R.

Value

The specified API key (NOTE: Avoid exposing this in the console).

Note

Find your personal API key at https://platform.openai.com/account/api-keys.

See Also

set_api_key.

Examples

## Not run: 
get_api_key()

## End(Not run)

AIscreenR documentation built on April 3, 2025, 7:11 p.m.