---
title: OpenAI TTS نص إلى كلام | RunAPI
description: استخدم نقطة نهاية تحويل النص إلى كلام لتلقّي نتيجة في الاستجابة ذاتها.
url: https://runapi.ai/ar/docs/api/openai-tts/text-to-speech.md
canonical: https://runapi.ai/ar/docs/api/openai-tts/text-to-speech
locale: ar
---

> نسخة HTML: https://runapi.ai/ar/docs/api/openai-tts/text-to-speech
> فهرس الموقع للوكلاء: https://runapi.ai/llms.txt

# OpenAI TTS نص إلى كلام

## نظرة عامة

استخدم نقطة نهاية تحويل النص إلى كلام واقرأ النتيجة من الاستجابة ذاتها.

### البدء السريع

1. أنشئ مفتاح API واضبطه كـ RUNAPI_API_KEY.
2. أرسل طلب POST يطابق نص الطلب مخطط الطلب.
3. اقرأ النتيجة من جسم الاستجابة الناجحة.

## نقطة النهاية

POST /api/v1/openai_tts/text_to_speech

عنوان URL الأساسي: https://runapi.ai

إصدار API: v1

المصادقة: Authorization: Bearer YOUR_API_TOKEN

## النماذج المدعومة

افتح صفحة النموذج للاطلاع على التسعير الحالي وحدود المعدل وتفاصيل الاستخدام التجاري.

- [tts-1](https://runapi.ai/ar/models/openai-tts/tts-1)
- [tts-1-hd](https://runapi.ai/ar/models/openai-tts/tts-1-hd)

## مخطط الطلب

أرسل الحقول المُعلنة لهذا الطرف فقط.

### tts-1

```json
{
  "model": {
    "description": "معرّف النموذج.",
    "required": true,
    "type": "string"
  },
  "text": {
    "length": true,
    "max": 4096,
    "required": true,
    "type": "string"
  }
}
```

### tts-1-hd

```json
{
  "model": {
    "description": "معرّف النموذج.",
    "required": true,
    "type": "string"
  },
  "text": {
    "length": true,
    "max": 4096,
    "required": true,
    "type": "string"
  }
}
```

## استجابة النجاح

HTTP 200 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "format": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url",
          "format",
          "mime_type",
          "size_bytes"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "audios": [
    {
      "format": "mp3",
      "mime_type": "audio/mpeg",
      "size_bytes": 128,
      "url": "https://file.runapi.ai/reference-audio.mp3"
    }
  ],
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed"
}
```

## الأخطاء

HTTP 401 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "error": {
      "description": "رسالة خطأ قابلة للقراءة البشرية.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "error": "Authentication required"
}
```

## الأخطاء

HTTP 400 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "رسالة خطأ قابلة للقراءة البشرية.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "ملخص التحقق القابل للقراءة البشرية.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "رسائل التحقق مفتاحها حقل الطلب العام، مع مصفوفة من السلاسل القابلة للقراءة البشرية لكل حقل.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### مثال على الاستجابة

```json
{
  "error": "model must be one of: tts-1, tts-1-hd"
}
```

## الأخطاء

HTTP 402 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "error": {
      "description": "رسالة خطأ قابلة للقراءة البشرية.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "error": "Insufficient balance"
}
```

## الأخطاء

HTTP 429 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "error": {
      "description": "رسالة خطأ قابلة للقراءة البشرية.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "error": "API key credit limit exceeded"
}
```

## الأخطاء

HTTP 409 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "error": {
      "description": "رسالة خطأ قابلة للقراءة البشرية.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## الأخطاء

HTTP 429 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "error": {
      "description": "رسالة خطأ قابلة للقراءة البشرية.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## الأخطاء

HTTP 503 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "error": {
      "description": "رسالة خطأ قابلة للقراءة البشرية.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## الأخطاء

HTTP 504 - POST /api/v1/openai_tts/text_to_speech

### مخطط الاستجابة

```json
{
  "properties": {
    "error": {
      "description": "رسالة خطأ قابلة للقراءة البشرية.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### مثال على الاستجابة

```json
{
  "error": "The request timed out"
}
```

## نماذج الأكواد المولَّدة

استخدم cURL مباشرةً، أو ثبّت SDK للغة البرمجة التي تستخدمها. كل نموذج يُرسل الطلب الذي تم التحقق من صحته كما هو موضح في هذا المرجع.

### curl

```curl
curl -X POST https://runapi.ai/api/v1/openai_tts/text_to_speech \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"tts-1","text":"Welcome to RunAPI."}'
```

### javascript

#### التثبيت

```bash
npm install @runapi.ai/openai-tts
```

```javascript
import { OpenaiTtsClient } from "@runapi.ai/openai-tts";

const client = new OpenaiTtsClient({ apiKey: process.env.RUNAPI_API_KEY });
const result = await client.textToSpeech.run({
  "model": "tts-1",
  "text": "Welcome to RunAPI."
});
```

### python

#### التثبيت

```bash
pip install runapi-openai-tts
```

```python
import os
from runapi.openai_tts import OpenaiTtsClient

client = OpenaiTtsClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.text_to_speech.run(
  model="tts-1",
  text="Welcome to RunAPI."
)
```

### go

#### التثبيت

```bash
go get github.com/runapi-ai/openai-tts-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  openaitts "github.com/runapi-ai/openai-tts-sdk/go/openaitts"
)

func main() {
  client, err := openaitts.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  result, err := client.TextToSpeech.Run(context.Background(), openaitts.TextToSpeechParams{
    Model: "tts-1",
    Text: "Welcome to RunAPI.",
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
```

### ruby

#### التثبيت

```bash
gem install runapi-openai-tts
```

```ruby
require "runapi/openai_tts"

client = RunApi::OpenaiTts::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
result = client.text_to_speech.run(
  model: "tts-1",
  text: "Welcome to RunAPI."
)
```

### java

#### التثبيت

```kotlin
implementation("ai.runapi:runapi-openai-tts")
```

```java
import ai.runapi.openaitts.OpenaiTtsClient;
import ai.runapi.openaitts.types.TextToSpeechParams;
import ai.runapi.openaitts.types.TextToSpeechResponse;

public final class Example {
  public static void main(String[] args) {
    OpenaiTtsClient client = OpenaiTtsClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TextToSpeechResponse result = client.textToSpeech().run(
        TextToSpeechParams.builder()
        .model("tts-1")
        .text("Welcome to RunAPI.")
            .build()
    );
  }
}
```

### php

#### التثبيت

```bash
composer require runapi-ai/openai-tts
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\OpenaiTts\OpenaiTtsClient;

$client = new OpenaiTtsClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$result = $client->textToSpeech->run([
  "model" => "tts-1",
  "text" => "Welcome to RunAPI."
]);
```

## الأدلة ذات الصلة

- [المصادقة](https://runapi.ai/ar/docs/guides/authentication.md)
- [البدء السريع](https://runapi.ai/ar/docs/guides/task-api/quickstart.md)

---

## المزيد من RunAPI

- [الرئيسية](https://runapi.ai/ar/.md)
- [كتالوج النماذج](https://runapi.ai/ar/models.md)
- [الأسعار](https://runapi.ai/ar/pricing.md)
- [مزودو الخدمة](https://runapi.ai/ar/models)
- [التوثيق](https://runapi.ai/ar/docs/guides)
- [حزم SDK](https://runapi.ai/ar/sdk.md)
- [CLI](https://runapi.ai/ar/cli.md)
- [خادم MCP](https://runapi.ai/ar/mcp.md)
- [Claude Code مقابل Cursor](https://runapi.ai/ar/claude-code-vs-cursor.md)
- [إعداد Cursor API](https://runapi.ai/ar/cursor-api-setup.md)
- [RunAPI مقابل OpenRouter](https://runapi.ai/ar/openrouter-alternative.md)
- [المؤسسات](https://runapi.ai/ar/contact.md)
- [اتصل بنا](https://runapi.ai/ar/contact.md)
- [الشروط](https://runapi.ai/ar/terms.md)
- [الخصوصية](https://runapi.ai/ar/privacy.md)
- [فهرس الموقع للوكلاء](https://runapi.ai/llms.txt)

التواصل: contact@runapi.ai

## البيانات المنظمة

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "ar",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/ar",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/ar/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ar",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/ar",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/aricon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ar",
    "@type": "TechArticle",
    "headline": "OpenAI TTS نص إلى كلام",
    "description": "استخدم نقطة نهاية تحويل النص إلى كلام لتلقّي نتيجة في الاستجابة ذاتها.",
    "url": "https://runapi.ai/ar/docs/api/openai-tts/text-to-speech",
    "mainEntityOfPage": "https://runapi.ai/ar/docs/api/openai-tts/text-to-speech"
  }
]
```
