> 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/troubleshooting.md).

# Troubleshooting

### Troubleshooting

#### Common Issues

**API Key Problems**

```bash
# Error: SecretAIAPIKeyMissingError
export SECRET_AI_API_KEY='your_actual_api_key'
```

**Connection Issues**

```python
# Test different node URLs
from secret_ai_sdk.secret import Secret

# Try alternative LCD endpoints
test_urls = [
    'https://lcd.secret.tactus.starshell.net/',
    'https://scrt-lcd.stakingcabin.com/',
    'https://secret-4.api.trivium.network:1317/'
]

for url in test_urls:
    try:
        client = Secret(node_url=url)
        models = client.get_models()
        print(f"✅ Working URL: {url}")
        break
    except Exception as e:
        print(f"❌ Failed URL {url}: {e}")
```

**Timeout Configuration**

```python
# Increase timeouts for slow networks
import os
os.environ['SECRET_AI_REQUEST_TIMEOUT'] = '60'
os.environ['SECRET_AI_CONNECT_TIMEOUT'] = '20'
os.environ['SECRET_AI_MAX_RETRIES'] = '5'
```

**Voice Service Issues**

```python
# Check voice service availability
def diagnose_voice_services():
    from secret_ai_sdk.voice_secret import VoiceSecret
    
    try:
        voice = VoiceSecret(
            stt_url="http://localhost:25436",
            tts_url="http://localhost:25435"
        )
        
        # Test individual services
        services = {
            'STT': voice.check_stt_health,
            'TTS': voice.check_tts_health
        }
        
        for name, check_func in services.items():
            try:
                status = check_func()
                print(f"{name}: {'✅ Available' if status else '❌ Unavailable'}")
            except Exception as e:
                print(f"{name}: ❌ Error - {e}")
    
    except Exception as e:
        print(f"Voice client initialization failed: {e}")

diagnose_voice_services()
```


---

# 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/troubleshooting.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.
