API Reference

API Reference for LangDB

Create chat completion

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
X-Project-IdstringRequired

LangDB project ID

Body
modelstringRequired

ID of the model to use. This can be either a specific model ID or a virtual model identifier.

Example: gpt-4o
temperaturenumber · max: 2Optional

Sampling temperature.

Example: 0.8
Responses
chevron-right
200

OK

application/json
post
/v1/chat/completions
200

OK

Create embeddings

post

Creates an embedding vector representing the input text or token arrays.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
modelstringRequired

ID of the model to use for generating embeddings.

Example: text-embedding-ada-002
inputone ofRequired
stringOptional

The text to embed.

or
string[]Optional

Array of text strings to embed.

encoding_formatstring · enumOptional

The format to return the embeddings in.

Default: floatPossible values:
dimensionsinteger · min: 1 · max: 1536Optional

The number of dimensions the resulting embeddings should have.

Example: 1536
Responses
chevron-right
200

Successful response with embeddings

application/json
post
/v1/embeddings
200

Successful response with embeddings

Retrieve a list of threads

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
X-Project-IdstringRequired

LangDB project ID

Body
limitinteger · min: 1RequiredExample: 10
offsetintegerRequiredExample: 100
Responses
chevron-right
200

A list of threads with pagination info

application/json
post
/threads
200

A list of threads with pagination info

Retrieve messages for a specific thread

get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
thread_idstring · uuidRequired

The ID of the thread to retrieve messages from

Header parameters
X-Project-IdstringRequired

LangDB project ID

Responses
chevron-right
200

A list of messages for the given thread

application/json
get
/threads/{thread_id}/messages
200

A list of messages for the given thread

Retrieve the total cost for a specific thread

get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
thread_idstring · uuidRequired

The ID of the thread for which to retrieve cost information

Header parameters
X-Project-IdstringRequired

LangDB project ID

Responses
chevron-right
200

The total cost and token usage for the specified thread

application/json
get
/threads/{thread_id}/cost
200

The total cost and token usage for the specified thread

Fetch analytics data

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
X-Project-IdstringRequired

LangDB project ID

Body
start_time_usinteger · int64Optional

Start time in microseconds.

Example: 1693062345678
end_time_usinteger · int64Optional

End time in microseconds.

Example: 1693082345678
Responses
chevron-right
200

Successful response

application/json
post
/analytics
200

Successful response

Fetch analytics summary

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
X-Project-IdstringRequired

LangDB project ID

Body
start_time_usinteger · int64OptionalExample: 1693062345678
end_time_usinteger · int64OptionalExample: 1693082345678
groupBystring[]RequiredExample: ["provider"]
Responses
chevron-right
200

Successful response

application/json
post
/analytics/summary
200

Successful response

Get total usage

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
X-Project-IdstringRequired

LangDB project ID

Body
start_time_usinteger · int64OptionalExample: 1693062345678
end_time_usinteger · int64Optional
Responses
chevron-right
200

OK

application/json
post
/usage/total
200

OK

Retrieve pricing information

get

Returns the pricing details for LangDB services.

Responses
chevron-right
200

Successful retrieval of pricing information

application/json
get
/pricing
200

Successful retrieval of pricing information

List models

get
Responses
chevron-right
200

OK

application/json
get
/models
200

OK

Was this helpful?