Skip to content

Commit ef09567

Browse files
authored
Merge pull request #167 from aimlapi/stelyatko/feat-add-qwen3-omni-snippet
2 parents 8c5d5e2 + d331467 commit ef09567

6 files changed

Lines changed: 110 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"title": "Audio captioning",
3+
"payload": {
4+
"baseUrl": "https://api.aimlapi.com/v1",
5+
"apiKey": "<YOUR_API_KEY>"
6+
}
7+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import OpenAI from 'openai';
2+
3+
const api = new OpenAI({
4+
baseURL: '{{baseUrl}}',
5+
apiKey: '{{apiKey}}',
6+
});
7+
8+
const main = async () => {
9+
const response = await api.chat.completions.create({
10+
model: '{{model}}',
11+
messages: [
12+
{
13+
role: 'user',
14+
content: [
15+
{
16+
type: 'input_audio',
17+
input_audio: {
18+
data: 'https://cdn.aimlapi.com/eagle/files/elephant/cJUTeeQmpodIV1Q3MWDAL_vibevoice-output-7b98283fd3974f48ba90e91d2ee1f971.mp3'
19+
}
20+
}
21+
]
22+
}
23+
],
24+
});
25+
26+
console.log(response.choices[0].message.content);
27+
};
28+
29+
main();
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from openai import OpenAI
2+
3+
client = OpenAI(
4+
base_url="{{baseUrl}}",
5+
api_key="{{apiKey}}",
6+
)
7+
8+
response = client.chat.completions.create(
9+
model="{{model}}",
10+
messages=[
11+
{
12+
"role": "user",
13+
"content": [
14+
{
15+
"type": "input_audio",
16+
"input_audio": {
17+
"data": "https://cdn.aimlapi.com/eagle/files/elephant/cJUTeeQmpodIV1Q3MWDAL_vibevoice-output-7b98283fd3974f48ba90e91d2ee1f971.mp3"
18+
}
19+
}
20+
]
21+
},
22+
],
23+
)
24+
25+
print(response.choices[0].message.content)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"title": "Text to Speech",
3+
"docs": "https://docs.aimlapi.com/api-references/speech-models/text-to-speech",
4+
"payload": {
5+
"baseUrl": "https://api.aimlapi.com/v1",
6+
"apiKey": "<YOUR_API_KEY>"
7+
}
8+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const axios = require('axios').default;
2+
3+
const api = axios.create({
4+
baseURL: '{{baseUrl}}',
5+
headers: { Authorization: 'Bearer {{apiKey}}' },
6+
});
7+
8+
const main = async () => {
9+
const response = await api.post('/tts', {
10+
model: '{{model}}',
11+
text: 'Qwen3 Speech Synthesis offers a range of natural, human-like voices with support for multiple languages and dialects. It can produce multilingual speech in a consistent voice, adapting tone and intonation to deliver smooth, expressive narration even for complex text.',
12+
voice: 'Cherry',
13+
});
14+
15+
console.log('Audio URL:', response.data.audio.url);
16+
console.log('Characters:', response.data.usage.characters);
17+
};
18+
19+
main();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import requests
2+
3+
4+
def main():
5+
url = "{{baseUrl}}/tts"
6+
headers = {
7+
"Authorization": "Bearer {{apiKey}}",
8+
}
9+
payload = {
10+
"model": "{{model}}",
11+
"text": "Qwen3 Speech Synthesis offers a range of natural, human-like voices with support for multiple languages and dialects. It can produce multilingual speech in a consistent voice, adapting tone and intonation to deliver smooth, expressive narration even for complex text.",
12+
"voice": "Cherry"
13+
}
14+
15+
response = requests.post(url, headers=headers, json=payload)
16+
data = response.json()
17+
18+
print("Audio URL:", data["audio"]["url"])
19+
print("Characters:", data["usage"]["characters"])
20+
21+
22+
main()

0 commit comments

Comments
 (0)