Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
API Version: v1
License: MIT
Server: {endpoint}/openai/v1 — Azure AI Foundry Models APIs
Server Variables:
| Variable | Default | Description |
|---|---|---|
| endpoint | A supported Azure AI Foundry Models APIs endpoint, including protocol and hostname. For example: https://westus.api.cognitive.microsoft.com). |
Authentication
ApiKeyAuth (API Key)
Pass your API key in the api-key header.
ApiKeyAuth_ (API Key)
Pass your API key in the authorization header.
OAuth2Auth (OAuth 2.0)
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Scopes:
https://cognitiveservices.azure.com/.default
Security Requirements
Endpoints accept any one of the following authentication methods:
- ApiKeyAuth
- ApiKeyAuth_
- OAuth2Auth (scopes:
https://cognitiveservices.azure.com/.default)
Create embedding
POST {endpoint}/openai/v1/embeddings
Creates an embedding vector representing the input text.
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| endpoint | server | Yes | string | A supported Azure AI Foundry Models APIs endpoint, including protocol and hostname. For example: https://westus.api.cognitive.microsoft.com). |
| api-version | query | No | string Possible values: v1, preview |
The explicit Azure AI Foundry Models API version to use for this request.v1 if not otherwise specified. |
Request Body
Content-Type: application/json
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| dimensions | integer | The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.Constraints: min: 1 |
No | |
| encoding_format | enum | The format to return the embeddings in. Can be either float or base64.Possible values: float, base64 |
No | float |
| input | string or array of string or array of integer or array of array | Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. Example Python code for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request. | Yes | |
| model | string | ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them. | Yes | |
| user | string | A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more. | No |
Responses
Status Code: 200
Description: The request has succeeded.
| Content-Type | Type | Description |
|---|---|---|
| application/json | OpenAI.CreateEmbeddingResponse |
Response Headers:
| Header | Type | Description |
|---|---|---|
| apim-request-id | string | A request ID used for troubleshooting purposes. |
Status Code: default
Description: An unexpected error response.
| Content-Type | Type | Description |
|---|---|---|
| application/json | object |
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| code | string or null | Yes | ||
| inner_error | No | |||
| message | string | Yes | ||
| param | string or null | Yes | ||
| type | string | Yes |
Response Headers:
| Header | Type | Description |
|---|---|---|
| apim-request-id | string | A request ID used for troubleshooting purposes. |
Examples
Example
POST {endpoint}/openai/v1/embeddings?api-version=v1
Components
AzureAIFoundryModelsApiVersion
| Property | Value |
|---|---|
| Type | string |
| Values | v1preview |
OpenAI.CreateEmbeddingRequest
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| dimensions | integer | The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.Constraints: min: 1 |
No | |
| encoding_format | enum | The format to return the embeddings in. Can be either float or base64.Possible values: float, base64 |
No | float |
| input | string or array of string or array of integer or array of array | Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. Example Python code for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request. | Yes | |
| model | string | ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them. | Yes | |
| user | string | A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more. | No |
OpenAI.CreateEmbeddingResponse
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| data | array of OpenAI.Embedding | The list of embeddings generated by the model. | Yes | |
| model | string | The name of the model used to generate the embedding. | Yes | |
| object | enum | The object type, which is always "list". Possible values: list |
Yes | |
| usage | OpenAI.CreateEmbeddingResponseUsage | Yes | ||
| └─ prompt_tokens | integer | Yes | ||
| └─ total_tokens | integer | Yes |
OpenAI.CreateEmbeddingResponseUsage
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| prompt_tokens | integer | Yes | ||
| total_tokens | integer | Yes |
OpenAI.Embedding
Represents an embedding vector returned by embedding endpoint.
| Name | Type | Description | Required | Default |
|---|---|---|---|---|
| embedding | array of number | The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the embedding guide. | Yes | |
| index | integer | The index of the embedding in the list of embeddings. | Yes | |
| object | enum | The object type, which is always "embedding". Possible values: embedding |
Yes |