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

# Quick First API Call

> Get started with CAMB.AI in under 5 minutes

This guide walks you through making your first CAMB.AI API call to generate speech from text.

## Prerequisites

1. A CAMB.AI account ([sign up at studio.camb.ai](https://studio.camb.ai))
2. Your API key (see [Authentication](/getting-started/authentication))

## Option 1: Using the SDK (Recommended)

<Steps>
  <Step title="Install the SDK">
    <CodeGroup>
      ```bash Python theme={null}
      pip install camb-sdk
      ```

      ```bash Node.js theme={null}
      npm install @camb-ai/sdk
      ```
    </CodeGroup>
  </Step>

  <Step title="Generate Speech">
    <CodeGroup>
      ```python Python theme={null}
      from camb.client import CambAI

      client = CambAI(api_key="YOUR_API_KEY")

      # Generate speech
      audio = client.tts.generate(
          text="Hello! Welcome to CAMB AI.",
          voice_id=147320
      )

      # Save to file
      with open("output.wav", "wb") as f:
          f.write(audio)

      print("Audio saved to output.wav")
      ```

      ```typescript TypeScript theme={null}
      import { CambClient, saveStreamToFile } from '@camb-ai/sdk';

      const client = new CambClient({ apiKey: "YOUR_API_KEY" });

      // Generate speech
      const response = await client.textToSpeech.tts({
         text: 'Welcome to our service. We\'re glad to have you here.',
          voice_id: 147320,
          language: 'en-us',
          speech_model: 'mars-8.1-flash-beta',
          output_configuration: { format: 'wav' }
      });

      // Save to file
      await saveStreamToFile(response, "output.wav");

      console.log("Audio saved to output.wav");
      ```
    </CodeGroup>
  </Step>

  <Step title="Play the Audio">
    Open `output.wav` with any audio player to hear the generated speech.
  </Step>
</Steps>

## Option 2: Using cURL

```bash theme={null}
curl -X POST "https://client.camb.ai/apis/tts-stream" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello! Welcome to CAMB AI.",
    "voice_id": 147320,
    "language": "en-us",
    "speech_model": "mars-8.1-flash-beta"
  }' \
  --output output.wav
```

## Option 3: Using the API Directly

<CodeGroup>
  ```python Python (requests) theme={null}
  import requests

  response = requests.post(
      "https://client.camb.ai/apis/tts-stream",
      headers={
          "x-api-key": "YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "text": "Hello! Welcome to CAMB AI.",
          "voice_id": 147320,
          "language": "en-us",
          "speech_model": "mars-8.1-flash-beta"
      }
  )

  with open("output.wav", "wb") as f:
      f.write(response.content)
  ```

  ```javascript JavaScript (fetch) theme={null}
  const response = await fetch("https://client.camb.ai/apis/tts-stream", {
    method: "POST",
    headers: {
      "x-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      text: "Hello! Welcome to CAMB AI.",
      voice_id: 147320,
      language: "en-us",
      speech_model: "mars-8.1-flash-beta"
    })
  });

  const audioData = await response.arrayBuffer();
  ```
</CodeGroup>

## Understanding the Response

The API returns raw audio data by default. Key parameters:

| Parameter | Description |
| - | - |
| `text` | The text to convert to speech |
| `voice_id` | ID of the voice to use (147320 is a default English voice) |
| `language` | Language code (e.g., `en-us`, `es-es`, `fr-fr`) |
| `speech_model` | Model variant: `mars-8.1-flash-beta`, `mars-8.1-pro-beta`, `mars-flash`, `mars-pro`, or `mars-instruct` |

## Output Formats

Specify the output format in `output_configuration`:

```json theme={null}
{
  "output_configuration": {
    "format": "wav"  // Options: "pcm_s16le", "wav", "mp3"
  }
}
```

## Explore Voices

List available voices to find the right one for your use case:

```bash theme={null}
curl -X GET "https://client.camb.ai/apis/list-voices" \
  -H "x-api-key: YOUR_API_KEY"
```

## Next Steps

<CardGroup cols={2}>
  <Card title="How Tasks & Runs Work" icon="list-check" href="/api-reference/basics/tasks-and-runs">
    Understand the async task pattern
  </Card>

  <Card title="SDK Guide" icon="code" href="/sdk-guides/general-guide">
    Deep dive into SDK features
  </Card>

  <Card title="MARS 8 Models" icon="bolt" href="/models">
    Compare TTS model variants
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/endpoint/create-tts-stream">
    Explore all endpoints
  </Card>
</CardGroup>
