|
| 1 | +# octave-2 |
| 2 | + |
| 3 | +{% columns %} |
| 4 | +{% column width="66.66666666666666%" %} |
| 5 | +{% hint style="info" %} |
| 6 | +This documentation is valid for the following list of our models: |
| 7 | + |
| 8 | +* `hume/octave-2` |
| 9 | +{% endhint %} |
| 10 | +{% endcolumn %} |
| 11 | + |
| 12 | +{% column width="33.33333333333334%" %} |
| 13 | +<a href="https://aimlapi.com/app/hume/octave-2" class="button primary">Try in Playground</a> |
| 14 | +{% endcolumn %} |
| 15 | +{% endcolumns %} |
| 16 | + |
| 17 | +An advanced text-to-speech model with improved emotional understanding, support for 11 languages, and sub-200 ms audio generation. It provides more reliable pronunciation of complex and uncommon inputs. |
| 18 | + |
| 19 | +## Setup your API Key |
| 20 | + |
| 21 | +If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up). |
| 22 | + |
| 23 | +## API Schema |
| 24 | + |
| 25 | +{% openapi-operation spec="octave-2" path="/v1/tts" method="post" %} |
| 26 | +[OpenAPI octave-2](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/speech-models/Hume-AI/octave-2.json) |
| 27 | +{% endopenapi-operation %} |
| 28 | + |
| 29 | +## Code Example |
| 30 | + |
| 31 | +{% tabs %} |
| 32 | +{% tab title="Python" %} |
| 33 | +{% code overflow="wrap" %} |
| 34 | +```python |
| 35 | +import requests |
| 36 | +import json |
| 37 | + |
| 38 | +# Insert your AI/ML API key instead of <YOUR_AIMLAPI_KEY>: |
| 39 | +api_key = "<YOUR_AIMLAPI_KEY>" |
| 40 | +base_url = "https://api.aimlapi.com/v1" |
| 41 | + |
| 42 | +headers = { |
| 43 | + "Authorization": f"Bearer {api_key}", |
| 44 | + "Content-Type": "application/json", |
| 45 | +} |
| 46 | + |
| 47 | +data = { |
| 48 | + "model": "hume/octave-2", |
| 49 | + "text": "It is a fast and powerful language model. Use it to convert text to natural sounding spoken text.", |
| 50 | + "voice": "Relaxing ASMR Woman", |
| 51 | +} |
| 52 | + |
| 53 | +response = requests.post(f"{base_url}/tts", headers=headers, json=data) |
| 54 | +response.raise_for_status() |
| 55 | + |
| 56 | +result = response.json() |
| 57 | +print(json.dumps(result, indent=2, ensure_ascii=False)) |
| 58 | +``` |
| 59 | +{% endcode %} |
| 60 | +{% endtab %} |
| 61 | + |
| 62 | +{% tab title="JaveScript" %} |
| 63 | +{% code overflow="wrap" %} |
| 64 | +```javascript |
| 65 | +import axios from "axios"; |
| 66 | + |
| 67 | +// Insert your AI/ML API key instead of <YOUR_AIMLAPI_KEY>: |
| 68 | +const apiKey = "<YOUR_API_KEY>"; |
| 69 | +const baseURL = "https://api.aimlapi.com/v1"; |
| 70 | + |
| 71 | +const headers = { |
| 72 | + Authorization: `Bearer ${apiKey}`, |
| 73 | + "Content-Type": "application/json", |
| 74 | +}; |
| 75 | + |
| 76 | +const data = { |
| 77 | + model: "inworld/tts-1", |
| 78 | + text: "It is a fast and powerful language model. Use it to convert text to natural sounding spoken text.", |
| 79 | + voice: "Deborah", |
| 80 | +}; |
| 81 | + |
| 82 | +const main = async () => { |
| 83 | + const response = await axios.post(`${baseURL}/tts`, data, { headers }); |
| 84 | + console.log(response); |
| 85 | +}; |
| 86 | + |
| 87 | +main().catch(console.error); |
| 88 | +``` |
| 89 | +{% endcode %} |
| 90 | +{% endtab %} |
| 91 | +{% endtabs %} |
| 92 | + |
| 93 | +<details> |
| 94 | + |
| 95 | +<summary>Response</summary> |
| 96 | + |
| 97 | +{% code overflow="wrap" %} |
| 98 | +``` |
| 99 | +{ |
| 100 | + "audio": { |
| 101 | + "url": "https://cdn.aimlapi.com/generations/hippopotamus/1769604037348-b2b0235e-e813-462d-904e-632803a698b4.wav" |
| 102 | + }, |
| 103 | + "meta": { |
| 104 | + "usage": { |
| 105 | + "credits_used": 12222 |
| 106 | + } |
| 107 | + } |
| 108 | +} |
| 109 | +``` |
| 110 | +{% endcode %} |
| 111 | + |
| 112 | +</details> |
| 113 | + |
| 114 | +Listen to the audio sample we generated (\~ 1.8 s): |
| 115 | + |
| 116 | +{% embed url="https://drive.google.com/file/d/1a4dW8Uz4VcxtOsgmcYF-ejzgMsGya0pP/view" %} |
0 commit comments