Skip to content
InfercomInfercomInfercom Documentation

Embeddings

Create embeddings

POST
/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)

Generate vector embeddings for input text. Note: This endpoint requires an embedding model to be available. Check GET /v1/models for current model availability.

Texts to embed and parameters

Media typeapplication/json
Embeddings Request

Embeddings request object

object
model
required
Any of:
string
input
required
One of:

The string that will be turned into an embedding.

string
key
additional properties
any
Example
{
"input": [
"text to embed number 1",
"text to embed number 2"
],
"model": "E5-Mistral-7B-Instruct"
}

Successful response

Media typeapplication/json
Embeddings Response

Embeddings response returned by the model

object
object
required
object

The object type, which is always “list”.

string
Allowed values: list
model
required

The name of the model used to generate the embedding.

string
usage
required
Usage

Usage metrics for the completion, embeddings,transcription or translation request

object
acceptance_rate
Acceptance Rate

Acceptance rate

number
completion_tokens
Completion Tokens

Number of tokens generated in completion

integer
completion_tokens_after_first_per_sec
Completion Tokens After First Per Sec

Completion tokens per second after first token generation

number
completion_tokens_after_first_per_sec_first_ten
Completion Tokens After First Per Sec First Ten

Completion tokens per second after first token generation first ten

number
completion_tokens_after_first_per_sec_graph
Completion Tokens After First Per Sec Graph

Completion tokens per second after first token generation

number
completion_tokens_per_sec
Completion Tokens Per Sec

Completion tokens per second

number
completion_tokens_details
Completion tokens details

Breakdown of the generated tokens. Returned by every model. Use it to budget and bill reasoning separately from the visible answer.

object
reasoning_tokens
Reasoning tokens

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

integer
key
additional properties
any
end_time
End Time

The Unix timestamp (in seconds) of when the generation finished.

number
is_last_response
Is Last Response

Whether or not is last response, always true for non streaming response

boolean
prompt_tokens_details
Prompt tokens details

Extra prompt token details. Not returned by /chat/completions. Prompt caching is reported on /responses as usage.input_tokens_details.cached_tokens instead.

object
cached_tokens
Cached tokens

Amount of cached tokens

integer
key
additional properties
any
prompt_tokens
Prompt Tokens

Number of tokens used in the prompt sent

integer
start_time
Start Time

The Unix timestamp (in seconds) of when the generation started.

number
time_to_first_token
Time To First Token

Also TTF, time (in seconds) taken to generate the first token

number
time_to_first_token_graph
Time To First Token Graph

Time to first token measurement for graphing/monitoring purposes

number
stop_reason
Stop Reason

The reason generation stopped. Values include stop (natural end or stop sequence), length (max_tokens reached), tool_calls (model invoked a tool).

string
nullable
total_latency
Total Latency

Total time (in seconds) taken to generate the full generation

number
total_tokens
Total Tokens

Prompt tokens + completion tokens

integer
total_tokens_per_sec
Total Tokens Per Sec

Tokens per second including prompt and completion

number
key
additional properties
any
data
required

The list of embeddings generated by the model.

Array<object>
Embedding

Represents an embedding vector returned by embeddings endpoint.

object
index
required
index

The index of the embedding in the list of embeddings.

integer
object
required
object

Object type, always embedding.

string
Allowed values: embedding
embedding
required
embedding

List of floats containing the embedding vector.

Array<number>
nullable
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
}
}
inference-id
string
Example
a0b08d8a-1893-45d6-a0f4-7ad6fdeb5443

Unique identifier for this inference request, useful for debugging and support.

x-ratelimit-limit-requests
integer
Example
250

Maximum requests allowed per minute.

x-ratelimit-limit-requests-day
integer
Example
50000

Maximum requests allowed per day.

x-ratelimit-remaining-requests
integer
Example
247

Remaining requests in the current minute window.

x-ratelimit-remaining-requests-day
integer
Example
49988

Remaining requests in the current day.

x-ratelimit-reset-requests
integer
Example
1776937132

Unix timestamp when the per-minute limit resets.

x-ratelimit-reset-requests-day
integer
Example
1777023472

Unix timestamp when the daily limit resets.

Bad Request - missing or invalid parameters, or a model that does not support embeddings.

Media typeapplication/json
GeneralError

Other kind of errors

object
error
required
object
code
code

Error code

string
nullable
message
message

Error message

string
param
param

Error params

string
nullable
type
type

Error type

string
request_id
request_id

Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.

string
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.

Media typeapplication/json
GeneralError

Other kind of errors

object
error
required
object
code
code

Error code

string
nullable
message
message

Error message

string
param
param

Error params

string
nullable
type
type

Error type

string
request_id
request_id

Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"param": "example",
"type": "example"
},
"request_id": "example"
}

Not found - the model ID does not exist.

Media typeapplication/json
GeneralError

Other kind of errors

object
error
required
object
code
code

Error code

string
nullable
message
message

Error message

string
param
param

Error params

string
nullable
type
type

Error type

string
request_id
request_id

Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"param": "example",
"type": "example"
},
"request_id": "example"
}

Request timeout

Media typeapplication/json
GeneralError

Other kind of errors

object
error
required
object
code
code

Error code

string
nullable
message
message

Error message

string
param
param

Error params

string
nullable
type
type

Error type

string
request_id
request_id

Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"param": "example",
"type": "example"
},
"request_id": "example"
}

Gone - model is no longer available (deprecated or removed)

Media typeapplication/json
GeneralError

Other kind of errors

object
error
required
object
code
code

Error code

string
nullable
message
message

Error message

string
param
param

Error params

string
nullable
type
type

Error type

string
request_id
request_id

Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"param": "example",
"type": "example"
},
"request_id": "example"
}

Too Many Requests

Media typeapplication/json
GeneralError

Other kind of errors

object
error
required
object
code
code

Error code

string
nullable
message
message

Error message

string
param
param

Error params

string
nullable
type
type

Error type

string
request_id
request_id

Unique identifier for the request. Quote it in any support report. Absent on the two responses that use the flat error shape.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"param": "example",
"type": "example"
},
"request_id": "example"
}

Internal Server Error. Unexpected issue on server side.

Media typetext/plain
string

Service Temporarily Unavailable

Media typetext/plain
string
Example
Service Temporarily Unavailable