> ## 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 Speech to Text からの移行

このガイドでは、**バッチ音声文字起こし**向けの OpenAI Speech to Text からの移行について説明します。

Cartesia の Batch Speech-to-Text API は OpenAI の API と互換性があるため、移行はいくつかのパラメーターを変更するだけで済みます。

<Card horizontal title="移行ガイドに戻る" icon="arrow-left-from-arc" href="/use-the-api/stt/migrations">
  OpenAI リアルタイム文字起こしやその他からの移行
</Card>

## エンドポイント

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

## OpenAI SDK を使用する

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

### サポートされるパラメーター

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

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

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

OpenAI SDK を Cartesia のベース URL に向け、モデルを `ink-whisper` に切り替えます：

<CodeGroup>
  ```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)
  ```

  ```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);
  ```
</CodeGroup>

## 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 Speech to Text から 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 レスポンスに文字起こしテキストとオプションで単語タイムスタンプが含まれます。
