> ## Documentation Index
> Fetch the complete documentation index at: https://tyk.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tyk AI Studio Environment Variables

> Environment variables and configuration options for Tyk AI Studio.

## Availability

| Edition                                                                                                                                         | Deployment Type      |
| :---------------------------------------------------------------------------------------------------------------------------------------------- | :------------------- |
| [Community](/5.12/ai-management/ai-studio/overview#community-edition) & [Enterprise](/5.12/ai-management/ai-studio/overview#enterprise-edition) | Self-Managed, Hybrid |

This page details the environment variables that can be used to configure Tyk AI Studio.

## Configuration

Tyk AI Studio is configured primarily using environment variables.

### Configuration Precedence

The application loads configuration in the following order of precedence (highest to lowest):

1. **Shell Environment Variables**: Variables set in the OS/Shell (e.g., `export SERVER_PORT=9090`) always override everything else.
2. **`.env` File**: Variables loaded from the file specified by the `-env` flag.
   * *Note:* The application checks if a variable is already set in the environment before loading it from the file, ensuring shell variables are preserved.

### Command Line Flags

You can specify a `.env` file using the `-env` flag when starting the binary:

```bash theme={null}
./ai-studio -env /path/to/my.env
```

### Supported Formats

Only the `.env` format (key=value pairs) is supported via the `-env` flag.

### Environment Variable Type Mapping

When configuring Tyk components using environment variables, it's important to understand how different data types are represented. The type of each variable is based on its definition in the Go source code. This section provides a guide on how to format values for common data types.

| Go Type                  | Environment Variable Format                | Example                                                              |
| ------------------------ | ------------------------------------------ | -------------------------------------------------------------------- |
| `string`                 | A regular string of text.                  | `TYK_GW_SECRET="mysecret"`                                           |
| `int`, `int64`           | A whole number.                            | `TYK_GW_LISTENPORT=8080`                                             |
| `bool`                   | `true` or `false`.                         | `TYK_GW_USEDBAPPCONFIG=true`                                         |
| `[]string`               | A comma-separated list of strings.         | `TYK_PMP_PUMPS_STDOUT_FILTERS_SKIPPEDAPIIDS="api1,api2,api3"`        |
| `map[string]string`      | A comma-separated list of key:value pairs. | `TYK_GW_GLOBALHEADERS="X-Tyk-Test:true,X-Tyk-Version:1.0"`           |
| `map[string]interface{}` | A JSON string representing the object.     | `TYK_GW_POLICIES_POLICYSOURCE_CONFIG='{"connection_string": "..."}'` |

<Note>
  For complex types like `map[string]interface{}`, the value should be a valid JSON string. For `[]string` and `map[string]string`, ensure there are no spaces around the commas unless they are part of the value itself.
</Note>

## Variables

### SERVER\_PORT

ENV: <b>SERVER\_PORT</b><br />
Type: `string`<br />
Default: `8080`<br />

The port for the AI Studio server to listen on.

### ALLOW\_REGISTRATIONS

ENV: <b>ALLOW\_REGISTRATIONS</b><br />
Type: `boolean`<br />
Default: `true`<br />

Allow new users to register.

### SITE\_URL

ENV: <b>SITE\_URL</b><br />
Type: `string`<br />

The public URL of the AI Studio.

### FROM\_EMAIL

ENV: <b>FROM\_EMAIL</b><br />
Type: `string`<br />

The email address to send emails from.

### DEVMODE

ENV: <b>DEVMODE</b><br />
Type: `boolean`<br />
Default: `false`<br />

Enable development mode.

### DEBUG\_HTTP

ENV: <b>DEBUG\_HTTP</b><br />
Type: `boolean`<br />
Default: `false`<br />

Enable HTTP debugging.

### DEBUG\_HTTP\_PROXY

ENV: <b>DEBUG\_HTTP\_PROXY</b><br />
Type: `boolean`<br />
Default: `false`<br />

Enable HTTP proxy debugging.

### DATABASE\_URL

ENV: <b>DATABASE\_URL</b><br />
Type: `string`<br />
Default: `midsommar.db`<br />

The database connection string.

### DATABASE\_TYPE

ENV: <b>DATABASE\_TYPE</b><br />
Type: `string`<br />
Default: `sqlite`<br />

The type of database to use (e.g., `sqlite`, `postgres`).

### ECHO\_CONVERSATION

ENV: <b>ECHO\_CONVERSATION</b><br />
Type: `boolean`<br />
Default: `false`<br />

Echo conversation messages for debugging.

### TYK\_AI\_SECRET\_KEY

ENV: <b>TYK\_AI\_SECRET\_KEY</b><br />
Type: `string`<br />

A secret key used for encrypting secrets and SSO.

### DOCS\_URL

ENV: <b>DOCS\_URL</b><br />
Type: `string`<br />

The URL for the documentation.

### PROXY\_URL

ENV: <b>PROXY\_URL</b><br />
Type: `string`<br />

The URL for the proxy.

### TOOL\_DISPLAY\_URL

ENV: <b>TOOL\_DISPLAY\_URL</b><br />
Type: `string`<br />

The display URL for tools in the UI.

### DATASOURCE\_DISPLAY\_URL

ENV: <b>DATASOURCE\_DISPLAY\_URL</b><br />
Type: `string`<br />

The display URL for datasources in the UI.

### FILTER\_SIGNUP\_DOMAINS

ENV: <b>FILTER\_SIGNUP\_DOMAINS</b><br />
Type: `string`<br />

A comma-separated list of domains to allow for signup.

### DEFAULT\_SIGNUP\_MODE

ENV: <b>DEFAULT\_SIGNUP\_MODE</b><br />
Type: `string`<br />
Default: `both`<br />

The default signup mode.

### AI\_STUDIO\_OCI\_CACHE\_DIR

ENV: <b>AI\_STUDIO\_OCI\_CACHE\_DIR</b><br />
Type: `string`<br />

The directory to cache OCI plugins.

### AI\_STUDIO\_OCI\_MAX\_CACHE\_SIZE

ENV: <b>AI\_STUDIO\_OCI\_MAX\_CACHE\_SIZE</b><br />
Type: `integer`<br />
Default: `1073741824`<br />

The maximum size of the OCI cache in bytes.

### AI\_STUDIO\_OCI\_REQUIRE\_SIGNATURE

ENV: <b>AI\_STUDIO\_OCI\_REQUIRE\_SIGNATURE</b><br />
Type: `boolean`<br />
Default: `false`<br />

Require OCI plugins to be signed.

### AI\_STUDIO\_OCI\_ALLOWED\_REGISTRIES

ENV: <b>AI\_STUDIO\_OCI\_ALLOWED\_REGISTRIES</b><br />
Type: `string`<br />

A comma-separated list of allowed OCI registries.

### AI\_STUDIO\_OCI\_TIMEOUT

ENV: <b>AI\_STUDIO\_OCI\_TIMEOUT</b><br />
Type: `string`<br />
Default: `30s`<br />

The timeout for OCI operations.

### AI\_STUDIO\_OCI\_RETRY\_ATTEMPTS

ENV: <b>AI\_STUDIO\_OCI\_RETRY\_ATTEMPTS</b><br />
Type: `integer`<br />
Default: `3`<br />

The number of retry attempts for OCI operations.

### AI\_STUDIO\_OCI\_GC\_INTERVAL

ENV: <b>AI\_STUDIO\_OCI\_GC\_INTERVAL</b><br />
Type: `string`<br />
Default: `24h`<br />

The garbage collection interval for the OCI cache.

### AI\_STUDIO\_OCI\_KEEP\_VERSIONS

ENV: <b>AI\_STUDIO\_OCI\_KEEP\_VERSIONS</b><br />
Type: `integer`<br />
Default: `3`<br />

The number of plugin versions to keep in the OCI cache.

### AI\_STUDIO\_OCI\_INSECURE\_REGISTRIES

ENV: <b>AI\_STUDIO\_OCI\_INSECURE\_REGISTRIES</b><br />
Type: `string`<br />

A comma-separated list of insecure OCI registries.

### OCI\_PLUGINS\_REGISTRY\_\*

ENV: <b>OCI\_PLUGINS\_REGISTRY\_\*</b><br />
Type: `string`<br />

Authentication for private OCI registries. See the `.env.example` file for more details.

### OCI\_PLUGINS\_PUBKEY\_\*

ENV: <b>OCI\_PLUGINS\_PUBKEY\_\*</b><br />
Type: `string`<br />

Public keys for verifying OCI plugin signatures. See the `.env.example` file for more details.

### ALLOW\_INTERNAL\_NETWORK\_ACCESS

ENV: <b>ALLOW\_INTERNAL\_NETWORK\_ACCESS</b><br />
Type: `boolean`<br />
Default: `false`<br />

Allow plugins to access internal network addresses.

### LOG\_LEVEL

ENV: <b>LOG\_LEVEL</b><br />
Type: `string`<br />
Default: `info`<br />

The log level (e.g., `trace`, `debug`, `info`, `warn`, `error`).

### SESSION\_DURATION

ENV: <b>SESSION\_DURATION</b><br />
Type: `string`<br />
Default: `6h`<br />

The duration of user sessions.

### TYK\_AI\_LICENSE

ENV: <b>TYK\_AI\_LICENSE</b><br />
Type: `string`<br />

The license key for Enterprise Edition.

### LICENSE\_TELEMETRY\_URL

ENV: <b>LICENSE\_TELEMETRY\_URL</b><br />
Type: `string`<br />
Default: `https://telemetry.tyk.technology/api/track`<br />

The URL for license telemetry.

### LICENSE\_TELEMETRY\_PERIOD

ENV: <b>LICENSE\_TELEMETRY\_PERIOD</b><br />
Type: `string`<br />
Default: `1h`<br />

The period for sending license telemetry.

### LICENSE\_VALIDITY\_CHECK\_PERIOD

ENV: <b>LICENSE\_VALIDITY\_CHECK\_PERIOD</b><br />
Type: `string`<br />
Default: `24h`<br />

The period for checking license validity.

### LICENSE\_DISABLE\_TELEMETRY

ENV: <b>LICENSE\_DISABLE\_TELEMETRY</b><br />
Type: `boolean`<br />
Default: `false`<br />

Disable license telemetry.

### LICENSE\_TELEMETRY\_CONCURRENCY

ENV: <b>LICENSE\_TELEMETRY\_CONCURRENCY</b><br />
Type: `integer`<br />
Default: `20`<br />

The maximum number of concurrent telemetry requests.

### GATEWAY\_MODE

ENV: <b>GATEWAY\_MODE</b><br />
Type: `string`<br />
Default: `standalone`<br />

The gateway mode (`standalone` or `control`).

### GRPC\_PORT

ENV: <b>GRPC\_PORT</b><br />
Type: `integer`<br />
Default: `50051`<br />

The gRPC server port.

### GRPC\_HOST

ENV: <b>GRPC\_HOST</b><br />
Type: `string`<br />
Default: `0.0.0.0`<br />

The gRPC server host.

### GRPC\_TLS\_INSECURE

ENV: <b>GRPC\_TLS\_INSECURE</b><br />
Type: `boolean`<br />
Default: `false`<br />

Set to `true` to disable TLS for the gRPC server.

### GRPC\_TLS\_CERT\_PATH

ENV: <b>GRPC\_TLS\_CERT\_PATH</b><br />
Type: `string`<br />

The path to the TLS certificate for the gRPC server.

### GRPC\_TLS\_KEY\_PATH

ENV: <b>GRPC\_TLS\_KEY\_PATH</b><br />
Type: `string`<br />

The path to the TLS key for the gRPC server.

### GRPC\_AUTH\_TOKEN

ENV: <b>GRPC\_AUTH\_TOKEN</b><br />
Type: `string`<br />

The authentication token for edge gateways to connect to the control plane.

### GRPC\_AUTH\_TOKEN\_NEXT

ENV: <b>GRPC\_AUTH\_TOKEN\_NEXT</b><br />
Type: `string`<br />

The next authentication token for zero-downtime rotation.
