> For the complete documentation index, see [llms.txt](https://docs.nexos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexos.ai/gateway-api/embeddings.md).

# Embeddings

Create vector embeddings for input text.

## Create embeddings

> Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Embeddings","description":"Create vector embeddings for input text."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: nexos-...` for a user key or `X-Api-Key: nexos-team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"EmbeddingsRequest":{"type":"object","properties":{"model":{"type":"string"},"input":{"description":"Input text to get embeddings for.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"integer"}},{"type":"array","items":{"type":"array","items":{"type":"integer"}}}]},"encoding_format":{"type":"string","description":"The format to return the embeddings in. Can be either float or base64.","enum":["float","base64"],"default":"float"},"dimensions":{"type":"integer","description":"The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.","minimum":1}},"required":["model","prompt"]}},"responses":{"EmbeddingsResponse":{"description":"Represents an embedding response returned by model, based on the provided input.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","description":"The object type, which is always \"list\""},"data":{"type":"array","items":{"type":"object","properties":{"object":{"type":"string","description":"The object type, which is always \"embedding\""},"embedding":{"type":"array","items":{"type":"number","format":"float"},"description":"The embedding vector"},"index":{"type":"integer","description":"The index of the embedding in the list"}}}},"model":{"type":"string","description":"The model used for generating embeddings"},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","description":"The number of tokens used in the prompt"},"total_tokens":{"type":"integer","description":"The total number of tokens used"},"nexos_credits_cost":{"type":"number","format":"double","description":"Cost of the request in nexos credits."}}}}}}}},"OutOfCredits":{"description":"The company has run out of AI credits. Returned when the company's budget limit has been reached.\n","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}}},"paths":{"/v1/embeddings":{"post":{"operationId":"post-embeddings-v1","summary":"Create embeddings","tags":["Embeddings"],"description":"Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/EmbeddingsResponse"},"400":{"description":"Invalid request data."},"402":{"$ref":"#/components/responses/OutOfCredits"},"500":{"description":"Server error."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexos.ai/gateway-api/embeddings.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
