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

# Ruby SDK Usage

> Current wrapper methods supported by the preview Ruby SDK.

## Setup

```ruby theme={null}
require 'ai_stats_sdk'

client = AIStatsSdk::AIStats.new(api_key: ENV.fetch('AI_STATS_API_KEY'))
```

## Chat completions

```ruby theme={null}
chat = client.generate_text(
  model: 'openai/gpt-5-nano',
  messages: [{ role: 'user', content: 'Hello' }]
)
```

## Responses

```ruby theme={null}
response = client.generate_response(
  model: 'openai/gpt-5-nano',
  input: 'Reply with: ruby sdk works'
)
```

## Images

```ruby theme={null}
image = client.generate_image(
  model: 'openai/gpt-image-1',
  prompt: 'A lighthouse at golden hour'
)

edit = client.generate_image_edit(
  model: 'openai/gpt-image-1',
  prompt: 'Make it sunset',
  image: 'data:image/png;base64,...'
)
```

## Audio

```ruby theme={null}
speech = client.generate_speech(
  model: 'openai/gpt-4o-mini-tts',
  input: 'Hello world'
)

transcription = client.generate_transcription(
  model: 'openai/gpt-4o-transcribe',
  audio_b64: 'base64-audio'
)

translation = client.generate_translation(
  model: 'openai/gpt-4o-transcribe',
  audio_b64: 'base64-audio'
)
```

## Embeddings and moderations

```ruby theme={null}
embedding = client.generate_embedding(
  model: 'openai/text-embedding-3-large',
  input: 'Sample text'
)

moderation = client.generate_moderation(
  model: 'openai/omni-moderation-latest',
  input: 'Some text to check'
)
```

## Models and health

```ruby theme={null}
models = client.list_models(limit: 10)
health = client.health
```
