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

# OpenAI Whisper から Cartesia Ink Whisper への移行

> OpenAI のクライアントライブラリで Cartesia の Batch Speech-to-Text API を使用します

<Info>
  Batch Speech-to-Text: このドキュメントは、Cartesia Ink のバッチ文字起こしエンドポイントにおける OpenAI SDK の互換性を説明します。

  リアルタイム文字起こしには [Realtime Speech-to-Text (Auto)](/api-reference/stt/turns/websocket) を使用してください。
</Info>

Cartesia の Batch Speech-to-Text API は OpenAI のクライアントライブラリと互換性があり、OpenAI Whisper からのシームレスな移行を可能にします。

## エンドポイント

**Cartesia ネイティブ:** `/stt` - すべての機能をサポート
**OpenAI 互換:** `/audio/transcriptions` - OpenAI SDK 上の Whisper をドロップインで置き換え

## OpenAI SDK の移行ガイド

OpenAI のベース URL を `https://api.cartesia.ai` に置き換えるだけで、Cartesia の互換レイヤーを使用できます:

### パラメータのサポート

**サポートされるパラメータ**:

* `file` - 文字起こしする音声ファイル
* `model` - Cartesia の最新モデルには `ink-whisper` を使用
* `language` - 入力音声の言語（ISO-639-1 形式）
* `timestamp_granularities` - 単語レベルのタイムスタンプを取得するには `["word"]` を含める

**レスポンス形式**: 常に JSON を返し、文字起こしテキスト、長さ、言語、オプションで単語タイムスタンプを含みます。

完全なパラメータリファレンスは [Batch STT API ドキュメント](/api-reference/stt/transcribe) を参照してください。

### Python の例

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="your-cartesia-api-key",
    base_url="https://api.cartesia.ai"
)

with open("audio.wav", "rb") as audio_file:
    transcript = client.audio.transcriptions.create(
        file=audio_file,
        model="ink-whisper",
        language="en",
        timestamp_granularities=["word"]
    )
    
print(transcript.text)
```

### Node.js の例

```typescript theme={null}
import OpenAI from 'openai';
import fs from 'fs';

const client = new OpenAI({
  apiKey: 'your-cartesia-api-key',
  baseURL: 'https://api.cartesia.ai'
});

const transcription = await client.audio.transcriptions.create({
  file: fs.createReadStream('audio.wav'),
  model: 'ink-whisper',
  language: 'en',
  timestamp_granularities: ['word']
});

console.log(transcription.text);
```

## API の直接利用

両エンドポイントは同じパラメータを受け取り、同じ JSON レスポンス形式を返します:

### Cartesia ネイティブエンドポイント

```bash theme={null}
curl -X POST https://api.cartesia.ai/stt \
  -H "X-API-Key: your-cartesia-api-key" \
  -F "file=@audio.wav" \
  -F "model=ink-whisper" \
  -F "language=en" \
  -F "timestamp_granularities[]=word"
```

### OpenAI 互換エンドポイント

```bash theme={null}
curl -X POST https://api.cartesia.ai/audio/transcriptions \
  -H "X-API-Key: your-cartesia-api-key" \
  -F "file=@audio.wav" \
  -F "model=ink-whisper" \
  -F "language=en" \
  -F "timestamp_granularities[]=word"
```

## OpenAI からの移行

OpenAI の Whisper API から Cartesia に移行するには:

1. **ベース URL を更新する**: `https://api.openai.com/v1` から `https://api.cartesia.ai` に変更
2. **認証情報を更新する**: OpenAI API キーを Cartesia API キーに置き換え
3. **モデル名を更新する**: OpenAI のモデル名の代わりに `ink-whisper` を使用
4. **同じエンドポイントを使い続ける**: `/audio/transcriptions` を引き続き使用
5. **未サポートのパラメータを避ける**: `prompt`、`temperature`、`response_format` パラメータを削除
6. **timestamp\_granularities を使用する（オプション）**: 単語レベルのタイムスタンプを取得するには `timestamp_granularities: ["word"]` を追加

コア機能は変わらず、JSON レスポンスに文字起こしテキストとオプションで単語タイムスタンプが含まれます。
