> For the complete documentation index, see [llms.txt](https://docs.scrt.network/secret-network-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scrt.network/secret-network-documentation/secret-ai/sdk/setting-up-your-environment/authentication-and-setup.md).

# Authentication & Setup

### Authentication & Setup

#### API Key Setup

To use the Secret AI SDK, you need a Secret AI API Key. Visit the [SecretAI Development Portal](https://aidev.scrtlabs.com/) to obtain your key.

Set your API key as an environment variable:

```bash
export SECRET_AI_API_KEY='your_api_key_here'
```

#### Environment Configuration

The SDK supports various configuration options via environment variables:

```bash
# Authentication
export SECRET_AI_API_KEY='your_api_key'

# Secret Network Configuration
export SECRET_NODE_URL='your_lcd_node_url'
export SECRET_CHAIN_ID='secret-4'
export SECRET_WORKER_SMART_CONTRACT='secret1xv90yettghx8uv6ug23knaf5mjqwlsghau6aqa'

# Network & Timeout Settings (seconds)
export SECRET_AI_REQUEST_TIMEOUT='30.0'
export SECRET_AI_CONNECT_TIMEOUT='10.0'

# Retry Configuration
export SECRET_AI_MAX_RETRIES='3'
export SECRET_AI_RETRY_DELAY='1.0'
export SECRET_AI_RETRY_BACKOFF='2.0'
export SECRET_AI_MAX_RETRY_DELAY='60.0'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.scrt.network/secret-network-documentation/secret-ai/sdk/setting-up-your-environment/authentication-and-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
