|
| 1 | +# Credentials |
| 2 | + |
| 3 | +Some GPTScript tools will use [credential tools](03-tools/04-credential-tools.md) to get sensitive information like API keys from the user. |
| 4 | +These credentials will be stored in a credential store and are used to set environment variables before executing a tool. |
| 5 | + |
| 6 | +GPTScript itself will also prompt you for your OpenAI API key and save it in the credential store if the |
| 7 | +`OPENAI_API_KEY` environment variable is not set. The environment variable always overrides the value stored in the |
| 8 | +credential store. |
| 9 | + |
| 10 | +## Credential Store |
| 11 | + |
| 12 | +There are different options available for credential stores, depending on your operating system. |
| 13 | +When you first run GPTScript, the default credential store for your operating system will be selected. |
| 14 | + |
| 15 | +You can change the credential store by modifying the `credsStore` field in your GPTScript configuration file. |
| 16 | +The configuration file is located in the following location based on your operating system: |
| 17 | +- Windows: `%APPDATA%\Local\gptscript\config.json` |
| 18 | +- macOS: `$HOME/Library/Application Support/gptscript/config.json` |
| 19 | +- Linux: `$XDG_CONFIG_HOME/gptscript/config.json` |
| 20 | + |
| 21 | +(Note: if you set the `XDG_CONFIG_HOME` environment variable on macOS, then the same path as Linux will be used.) |
| 22 | + |
| 23 | +The configured credential store will be automatically downloaded and compiled from the [gptscript-ai/gptscript-credential-helpers](https://github.com/gptscript-ai/gptscript-credential-helpers) |
| 24 | +repository, other than the `file` store, which is built-in to GPTScript itself. |
| 25 | +The `wincred` and `osxkeychain` stores do not require any external dependencies in order to compile correctly. |
| 26 | +The `secretservice` store on Linux may require some extra packages to be installed, depending on your distribution. |
| 27 | + |
| 28 | +## Credential Store Options |
| 29 | + |
| 30 | +### Wincred (Windows) |
| 31 | + |
| 32 | +Wincred, or the Windows Credential Manager, is the default credential store for Windows. |
| 33 | +This is Windows' built-in credential manager that securely stores credentials for Windows applications. |
| 34 | +This credential store is called `wincred` in GPTScript's configuration. |
| 35 | + |
| 36 | +### macOS Keychain (macOS) |
| 37 | + |
| 38 | +The macOS Keychain is the default credential store for macOS. |
| 39 | +This is macOS' built-in password manager that securely stores credentials for macOS applications. |
| 40 | +This credential store is called `osxkeychain` in GPTScript's configuration. |
| 41 | + |
| 42 | +### File (all operating systems) |
| 43 | + |
| 44 | +"File" is the default credential store for every other operating system besides Windows and macOS, but it |
| 45 | +can also be configured on Windows and macOS. This will store credentials **unencrypted** inside GPTScript's |
| 46 | +configuration file. |
| 47 | +This credential store is called `file` in GPTScript's configuration. |
| 48 | + |
| 49 | +### D-Bus Secret Service (Linux) |
| 50 | + |
| 51 | +The D-Bus Secret Service can be used as the credential store for Linux systems with a desktop environment that supports it. |
| 52 | +This credential store is called `secretservice` in GPTScript's configuration. |
| 53 | + |
| 54 | +### Pass (Linux) |
| 55 | + |
| 56 | +Pass can be used as the credential store for Linux systems. This requires the `pass` package to be installed |
| 57 | +and configured. See [this guide](https://www.howtogeek.com/devops/how-to-use-pass-a-command-line-password-manager-for-linux-systems/) |
| 58 | +for information about how to set it up. |
| 59 | +This credential store is called `pass` in GPTScript's configuration. |
| 60 | + |
| 61 | +## GPTScript `credential` Command |
| 62 | + |
| 63 | +The `gptscript credential` command can be used to interact with your stored credentials. |
| 64 | +`gptscript credential` without any arguments will list all stored credentials. |
| 65 | +`gptscript credential delete <credential name>` will delete the specified credential, and you will be |
| 66 | +prompted to enter it again the next time a tool that requires it is run. |
| 67 | + |
| 68 | +## See Also |
| 69 | + |
| 70 | +For more advanced credential usage, including credential contexts, writing credential tools, and using |
| 71 | +credential tools, see [the credential tools documentation](03-tools/04-credential-tools.md). |
0 commit comments