---
title: OpenAI Embeddings | RunAPI
description: Wyślij żądanie przez operację Embeddings kompatybilną z OpenAI w RunAPI.
url: https://runapi.ai/pl/docs/api/openai/embeddings.md
canonical: https://runapi.ai/pl/docs/api/openai/embeddings
locale: pl
---

> Wersja HTML: https://runapi.ai/pl/docs/api/openai/embeddings
> Indeks witryny dla agentów: https://runapi.ai/llms.txt

# OpenAI Embeddings

## Omówienie

Użyj operacji Embeddings zgodnej z OpenAI w RunAPI z kompatybilnym modelem oraz kształtami żądań i odpowiedzi protokołu.

### Szybki start

1. Utwórz klucz API i ustaw go jako RUNAPI_API_KEY.
2. Wybierz zgodny model, a następnie wyślij udokumentowane parametry ścieżki i treść JSON.
3. Odczytaj odpowiedź JSON lub zdarzenia wysyłane przez serwer pokazane dla tej operacji i obsłuż błędy protokołu.

## Punkt końcowy

POST /v1/embeddings

Bazowy URL: https://runapi.ai

Wersja kontraktu: v1

Preferowane uwierzytelnianie: Authorization: Bearer YOUR_API_TOKEN

## Nośniki uwierzytelniania

RunAPI akceptuje każdy z wymienionych poniżej protokołów. Wygenerowane przykłady używają preferowanego nagłówka danego protokołu.

- `Authorization: Bearer YOUR_API_TOKEN` (Preferowane)
- `x-api-key: YOUR_API_TOKEN`
- `x-goog-api-key: YOUR_API_TOKEN`
- `?key=YOUR_API_TOKEN`

## Zgodne modele

Otwórz stronę modelu, aby zapoznać się z aktualnymi cenami, limitami żądań i szczegółami dotyczącymi użytku komercyjnego.

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

## Kontrakt żądania

Wymieniane są tylko pola mające zarówno publiczną dokumentację protokołu, jak i potwierdzenie obsługi przez RunAPI. Dodatkowe pola treści JSON są przekazywane bez zmian.

### Treść JSON

Wymagane: `model`, `input`

```json
{
  "dimensions": {
    "description": "Żądane wymiary wektora wyjściowego dla modeli, które to obsługują.",
    "type": "integer"
  },
  "encoding_format": {
    "description": "Format używany dla zwracanych wektorów osadzeń.",
    "type": "string"
  },
  "input": {
    "description": "Tekst lub tablice tokenów do osadzenia.",
    "type": [
      "string",
      "array"
    ]
  },
  "model": {
    "description": "Identyfikator modelu osadzania RunAPI.",
    "type": "string"
  }
}
```

### Przykład żądania

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

## Odpowiedź synchroniczna

HTTP 200

### Schemat

```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"
}
```

### Przykład

```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
  }
}
```

## Błąd protokołu: invalid_request

HTTP 400

### Schemat

```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"
}
```

### Przykład

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

## Użycie

### Schemat

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

### Przykład

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

## Wygenerowane przykłady kodu

Każdy przykład cURL, JavaScript i Python wysyła zwalidowane żądanie z tej specyfikacji bez konieczności używania SDK właściwego dla protokołu.

### 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

#### Instalacja

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

## Powiązane przewodniki

- [Uwierzytelnianie](https://runapi.ai/pl/docs/guides/authentication.md)
- [Szybki start](https://runapi.ai/pl/docs/guides/llm-api/quickstart.md)

---

## Więcej od RunAPI

- [Strona główna](https://runapi.ai/pl/.md)
- [Katalog modeli](https://runapi.ai/pl/models.md)
- [Cennik](https://runapi.ai/pl/pricing.md)
- [Dostawcy](https://runapi.ai/pl/models)
- [Dokumentacja](https://runapi.ai/pl/docs/guides)
- [SDK](https://runapi.ai/pl/sdk.md)
- [CLI](https://runapi.ai/pl/cli.md)
- [Serwer MCP](https://runapi.ai/pl/mcp.md)
- [Claude Code vs Cursor](https://runapi.ai/pl/claude-code-vs-cursor.md)
- [Konfiguracja Cursor API](https://runapi.ai/pl/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/pl/openrouter-alternative.md)
- [Enterprise](https://runapi.ai/pl/contact.md)
- [Kontakt](https://runapi.ai/pl/contact.md)
- [Regulamin](https://runapi.ai/pl/terms.md)
- [Prywatność](https://runapi.ai/pl/privacy.md)
- [Indeks witryny dla agentów](https://runapi.ai/llms.txt)

Kontakt: contact@runapi.ai

## Dane strukturalne

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "pl",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/pl",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/pl/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "pl",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/pl",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/plicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "pl",
    "@type": "TechArticle",
    "headline": "OpenAI Embeddings",
    "description": "Wyślij żądanie przez operację Embeddings kompatybilną z OpenAI w RunAPI.",
    "url": "https://runapi.ai/pl/docs/api/openai/embeddings",
    "mainEntityOfPage": "https://runapi.ai/pl/docs/api/openai/embeddings"
  }
]
```
