# API Reference

### API Reference

#### Secret Class

Main client for interacting with Secret Network smart contracts.

```python
class Secret:
    def __init__(self, chain_id: str = None, node_url: str = None)
    def get_models(self) -> List[str]
    def get_urls(self, model: str) -> List[str]
```

#### ChatSecret Class

LangChain-compatible chat interface for text generation.

```python
class ChatSecret(ChatOllama):
    def __init__(self, base_url: str, model: str, **kwargs)
    def invoke(self, messages: List[Tuple[str, str]], **kwargs) -> str
    def stream(self, messages: List[Tuple[str, str]], **kwargs) -> Iterator[str]
```

#### VoiceSecret Class

Unified interface for speech-to-text and text-to-speech operations.

```python
class VoiceSecret:
    def __init__(self, stt_url: str, tts_url: str, api_key: str = None)
    def transcribe_audio(self, audio_file: Union[str, Path, BinaryIO]) -> Dict[str, Any]
    def synthesize_speech(self, text: str, model: str = "tts-1", 
                         voice: str = "af_alloy", **kwargs) -> bytes
    def check_stt_health(self) -> bool
    def check_tts_health(self) -> bool
    def get_available_voices(self) -> List[str]
    def get_available_models(self) -> List[Dict[str, Any]]
```

#### Enhanced Clients

Advanced clients with retry logic and enhanced error handling.

```python
class EnhancedSecretAIClient(OllamaClient):
    def __init__(self, host: str = None, api_key: str = None, 
                 timeout: float = None, max_retries: int = None, **kwargs)

class EnhancedSecretAIAsyncClient(OllamaAsyncClient):
    def __init__(self, host: str = None, api_key: str = None, 
                 timeout: float = None, max_retries: int = None, **kwargs)
```


---

# Agent Instructions: 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:

```
GET https://docs.scrt.network/secret-network-documentation/secret-ai/sdk/setting-up-your-environment/api-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
