---
title: OpenAI Embeddings | RunAPI
description: أرسل طلباً عبر عملية Embeddings المتوافقة مع OpenAI في RunAPI.
url: https://runapi.ai/ar/docs/api/openai/embeddings.md
canonical: https://runapi.ai/ar/docs/api/openai/embeddings
locale: ar
---

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

# OpenAI Embeddings

## نظرة عامة

استخدم عملية Embeddings المتوافقة مع OpenAI في RunAPI مع نموذج متوافق وأشكال الطلب والاستجابة الخاصة بالبروتوكول.

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

1. أنشئ مفتاح API واضبطه كـ RUNAPI_API_KEY.
2. اختر نموذجاً متوافقاً، ثم أرسل معاملات المسار الموثَّقة وجسم JSON.
3. اقرأ استجابة JSON أو أحداث الخادم المُرسَلة المعروضة لهذه العملية، وتعامل مع أخطاء البروتوكول.

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

POST /v1/embeddings

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

إصدار العقد: v1

المصادقة المفضّلة: Authorization: Bearer YOUR_API_TOKEN

## وسائل حمل المصادقة

يقبل RunAPI كل بروتوكول مُدرج أدناه. تستخدم العينات المُولَّدة الترويسة المفضَّلة للبروتوكول.

- `Authorization: Bearer YOUR_API_TOKEN` (مفضّل)
- `x-api-key: YOUR_API_TOKEN`
- `x-goog-api-key: YOUR_API_TOKEN`
- `?key=YOUR_API_TOKEN`

## النماذج المتوافقة

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

- [text-embedding-3-large](https://runapi.ai/ar/models/gpt)
- [text-embedding-3-small](https://runapi.ai/ar/models/gpt)
- [text-embedding-ada-002](https://runapi.ai/ar/models/gpt)

## عقد الطلب

تُدرج فقط الحقول التي تتوفر لها أدلة دعم من بروتوكول عام ومن RunAPI. تُمرَّر حقول نص JSON الإضافية كما هي.

### جسم JSON

مطلوب: `model`, `input`

```json
{
  "dimensions": {
    "description": "أبعاد المتجه في الإخراج المطلوبة للنماذج التي تدعم ذلك.",
    "type": "integer"
  },
  "encoding_format": {
    "description": "التنسيق المستخدم لمتجهات التضمين المُعادة.",
    "type": "string"
  },
  "input": {
    "description": "نص أو مصفوفات رموز للتضمين.",
    "type": [
      "string",
      "array"
    ]
  },
  "model": {
    "description": "معرّف نموذج التضمين في RunAPI.",
    "type": "string"
  }
}
```

### مثال على الطلب

```json
{
  "input": "The quick brown fox.",
  "model": "text-embedding-3-small"
}
```

## استجابة متزامنة

HTTP 200

### المخطط

```json
{
  "additionalProperties": true,
  "properties": {
    "data": {
      "type": "array"
    },
    "model": {
      "type": "string"
    },
    "object": {
      "const": "list",
      "type": "string"
    },
    "usage": {
      "additionalProperties": true,
      "properties": {
        "prompt_tokens": {
          "type": "integer"
        },
        "total_tokens": {
          "type": "integer"
        }
      },
      "required": [
        "prompt_tokens",
        "total_tokens"
      ],
      "type": "object"
    }
  },
  "required": [
    "object",
    "data",
    "model",
    "usage"
  ],
  "type": "object"
}
```

### مثال

```json
{
  "data": [
    {
      "embedding": [
        0.0023,
        -0.0093,
        0.0151
      ],
      "index": 0,
      "object": "embedding"
    }
  ],
  "model": "text-embedding-3-small",
  "object": "list",
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}
```

## خطأ في البروتوكول: invalid_request

HTTP 400

### المخطط

```json
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}
```

### مثال

```json
{
  "error": {
    "code": null,
    "message": "input is required",
    "param": "input",
    "type": "invalid_request_error"
  }
}
```

## الاستخدام

### المخطط

```json
{
  "additionalProperties": true,
  "properties": {
    "prompt_tokens": {
      "type": "integer"
    },
    "total_tokens": {
      "type": "integer"
    }
  },
  "required": [
    "prompt_tokens",
    "total_tokens"
  ],
  "type": "object"
}
```

### مثال

```json
{
  "prompt_tokens": 5,
  "total_tokens": 5
}
```

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

كل نموذج من نماذج cURL وJavaScript وPython يُرسل الطلب المُتحقق منه من هذا العقد دون الحاجة إلى SDK خاص بالبروتوكول.

### curl

```curl
curl -X POST https://runapi.ai/v1/embeddings \
  -H Authorization:\ Bearer\ YOUR_API_TOKEN \
  -H Content-Type:\ application/json \
  -d \{\"model\":\"text-embedding-3-small\",\"input\":\"The\ quick\ brown\ fox.\"\}
```

### javascript

```javascript
const response = await fetch("https://runapi.ai/v1/embeddings", {
  method: "POST",
  headers: {
  "Authorization": "Bearer YOUR_API_TOKEN",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "model": "text-embedding-3-small",
  "input": "The quick brown fox."
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
```

### python

#### التثبيت

```bash
pip install requests
```

```python
import requests

response = requests.post(
    "https://runapi.ai/v1/embeddings",
    headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
    json={"model": "text-embedding-3-small", "input": "The quick brown fox."}
)
response.raise_for_status()
print(response.json())
```

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

- [المصادقة](https://runapi.ai/ar/docs/guides/authentication.md)
- [البدء السريع](https://runapi.ai/ar/docs/guides/llm-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 Embeddings",
    "description": "أرسل طلباً عبر عملية Embeddings المتوافقة مع OpenAI في RunAPI.",
    "url": "https://runapi.ai/ar/docs/api/openai/embeddings",
    "mainEntityOfPage": "https://runapi.ai/ar/docs/api/openai/embeddings"
  }
]
```
