# oxide

## sunocore

Rust library for interacting with the Suno API.

### Running Tests

1. **Install cargo-nextest**: [Installation Guide](https://nexte.st/docs/installation/pre-built-binaries/)

2. **Set up environment variables** (see below)

   **Note**: Integration tests are currently configured to run against the staging environment. They will only pass with:
   ```bash
   SUNO_BASE_URL="https://studio-api.staging.suno.com"
   ```

3. **Run tests**:
   ```bash
   cd sunocore
   cargo nextest run              # Run all tests (19 tests)
   cargo nextest run -- --ignored # Run only ignored tests (7 additional tests)
   ```

## Environment Variables

Create a `.env` file in the repository root with the following variables:

### Required Variables

- **`SUNO_BASE_URL`** (required)
  - Base URL for the Suno API backend
  - Example: `SUNO_BASE_URL=http://127.0.0.1:8000` (local)
  - Example: `SUNO_BASE_URL=https://studio-api.staging.suno.com` (staging)

### Optional Variables

- **`SUNO_API_KEY`** (optional)
  - API key for authenticating with the Suno backend
  - Required if your backend enforces authentication
  - Keys must match what is stored in the `clips_usertoken` table
  - Example: `SUNO_API_KEY=abc123def456ghi789jkl012mno345pq`

- **`CDN_BASE_URL`** (optional)
  - Base URL for CDN resources (MP3 files, etc.)
  - Default: `https://cdn1.suno.ai`
  - Example: `CDN_BASE_URL=https://cdn1.suno.ai`

### Example `.env` file

```bash
# Required
SUNO_BASE_URL=http://127.0.0.1:8000

# Authentication
SUNO_API_KEY=abc123def456ghi789jkl012mno345pq

# Optional - CDN
CDN_BASE_URL=https://cdn1.suno.ai
```