Embeddings
Create embeddings
from openai import OpenAI
client = OpenAI( base_url="https://api.infercom.ai/v1", api_key="your-infercom-api-key",)
response = client.embeddings.create( input=["text to embed"], model="E5-Mistral-7B-Instruct",)
print(response.data[0].embedding)curl -X POST https://api.infercom.ai/v1/embeddings \ -H "Authorization: Bearer $INFERCOM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": ["text to embed"], "model": "E5-Mistral-7B-Instruct" }'Generate vector embeddings for input text. Note: This endpoint requires an embedding model to be available. Check GET /v1/models for current model availability.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Texts to embed and parameters
Embeddings request object
object
The string that will be turned into an embedding.
The array of strings that will be turned into an embeddings.
Example
{ "input": [ "text to embed number 1", "text to embed number 2" ], "model": "E5-Mistral-7B-Instruct"}Responses
Section titled “Responses”Successful response
Embeddings response returned by the model
object
The object type, which is always “list”.
The name of the model used to generate the embedding.
Usage metrics for the completion, embeddings,transcription or translation request
object
Acceptance rate
Number of tokens generated in completion
Completion tokens per second after first token generation
Completion tokens per second after first token generation first ten
Completion tokens per second after first token generation
Completion tokens per second
Breakdown of the generated tokens. Returned by every model. Use it to budget and bill reasoning separately from the visible answer.
object
Number of tokens spent on the chain of thought. Counts towards completion_tokens and therefore towards max_tokens. Returns 0 when the model did not reason, for example gemma-4-31B-it without chat_template_kwargs: {"enable_thinking": true}.
The Unix timestamp (in seconds) of when the generation finished.
Whether or not is last response, always true for non streaming response
Extra prompt token details. Not returned by /chat/completions. Prompt caching is reported on /responses as usage.input_tokens_details.cached_tokens instead.
object
Amount of cached tokens
Number of tokens used in the prompt sent
The Unix timestamp (in seconds) of when the generation started.
Also TTF, time (in seconds) taken to generate the first token
Time to first token measurement for graphing/monitoring purposes
The reason generation stopped. Values include stop (natural end or stop sequence), length (max_tokens reached), tool_calls (model invoked a tool).
Total time (in seconds) taken to generate the full generation
Prompt tokens + completion tokens
Tokens per second including prompt and completion
The list of embeddings generated by the model.
Represents an embedding vector returned by embeddings endpoint.
object
The index of the embedding in the list of embeddings.
Object type, always embedding.
List of floats containing the embedding vector.
Example
{ "data": [ { "index": 0, "object": "embedding", "embedding": [ 0.024864232167601585, -0.01452154759317636, 0.008880083449184895 ] }, { "index": 1, "object": "embedding", "embedding": [ 0.010919672437012196, 0.0016351072117686272, 0.008019134402275085 ] } ], "model": "E5-Mistral-7B-Instruct", "object": "list", "usage": { "prompt_tokens": 716, "total_tokens": 716 }}Headers
Section titled “Headers”Example
a0b08d8a-1893-45d6-a0f4-7ad6fdeb5443Unique identifier for this inference request, useful for debugging and support.
Example
250Maximum requests allowed per minute.
Example
50000Maximum requests allowed per day.
Example
247Remaining requests in the current minute window.
Example
49988Remaining requests in the current day.
Example
1776937132Unix timestamp when the per-minute limit resets.
Example
1777023472Unix timestamp when the daily limit resets.
Bad Request - missing or invalid parameters, or a model that does not support embeddings.
Other kind of errors
object
object
Error code
Error message
Error params
Error type
Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.
Example
{ "error": { "message": "Invalid request body:\n- missing property 'input'", "type": "invalid_request_error", "param": null, "code": null }, "request_id": "dagknf67sdbsi2nmgr5g"}Unauthorized - the API key is missing, incorrect or revoked.
Other kind of errors
object
object
Error code
Error message
Error params
Error type
Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.
Examplegenerated
{ "error": { "code": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}Not found - the model ID does not exist.
Other kind of errors
object
object
Error code
Error message
Error params
Error type
Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.
Examplegenerated
{ "error": { "code": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}Request timeout
Other kind of errors
object
object
Error code
Error message
Error params
Error type
Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.
Examplegenerated
{ "error": { "code": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}Gone - model is no longer available (deprecated or removed)
Other kind of errors
object
object
Error code
Error message
Error params
Error type
Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.
Examplegenerated
{ "error": { "code": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}Too Many Requests
Other kind of errors
object
object
Error code
Error message
Error params
Error type
Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.
Examplegenerated
{ "error": { "code": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}Internal Server Error. Unexpected issue on server side.
Service Temporarily Unavailable
Example
Service Temporarily Unavailable