Skip to content

Create embeddings

POST
/embeddings
curl --request POST \
--url https://api.katara.com/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "model": "katara/bge-base-en-v1.5@1", "input": [ "The first passage.", "The second passage." ] }'

The OpenAI embeddings request. One vector per input, from katara/bge-base-en-v1.5@1 (768 dimensions, up to 100 inputs of up to 512 tokens each). A key pays with Account Credits or USDC; without a key the call is paid with x402 like a chat completion: the quote assumes every input is as long as the model takes, the settlement charges the tokens counted, at least 0.025 USDC. Embeddings never reach Katara Community. Embeddings describes the fields.

PAYMENT-SIGNATURE
string

Without a key, base64 of the x402 payment payload that signs the quote from a previous 402.

X-PAYMENT
string

The same payload under the header name of the first x402 version, paid with exact.

Media typeapplication/json
object
model
required
string
input
required
Any of:
string
encoding_format
string
default: float
Allowed values: float base64
dimensions

Only the model’s own size.

integer
user

Accepted and not passed on.

string
Example
{
"model": "katara/bge-base-en-v1.5@1",
"input": [
"The first passage.",
"The second passage."
]
}

The vectors.

Media typeapplication/json
object
object
required
string
Allowed value: list
data
required
Array<object>
object
object
string
Allowed value: embedding
index
integer
embedding
Any of:
Array<number>
model
required
string
usage
required
object
prompt_tokens

The tokens charged for.

integer
total_tokens
integer
katara
Any of:

What this reply cost.

object
cost_usdc
required

The settled price, in USDC, as a decimal string. For a request paid with x402 it is the charge, the model’s minimum included (0.025 USDC, 0.05 for katara/cortex-genius, 0.01 for katara/cortex-smart).

string
cost_usd

The Credits charge as a decimal string. This legacy field name is retained for compatibility; display Credits without a dollar sign.

string
billing_method
string
Allowed values: credits usdc
payment

On a request paid with x402, the payment that settles the reply.

object
scheme
string
Allowed values: upto exact
network
string
asset

The token paid.

string
amount

The charge in the token’s base units, the same as amount in PAYMENT-RESPONSE.

string
provider

The provider’s address, or managed when a vendor answered.

string
cached_tokens

Prompt tokens the vendor read from its cache, billed at the cached input rate.

integer
cache_saving_usdc

What the cached tokens saved against the input rate, in USDC.

string
cache_saving_usd

The same saving in Credits, on a reply paid with account credits.

string
compaction

When katara.compaction summarised the conversation.

object
message

The system message to send in place of the summarised messages.

object
replaces_from

First index in this request’s messages that the summary replaces.

integer
replaces_to

First index kept after it.

integer
model
string
tokens_before
integer
summary

The summary request’s usage and its cost (cost_usdc or cost_usd).

object
skipped

Why no summary was made; the request went whole.

string
context_edits
object
cleared_tool_results
integer
cleared_tokens
integer
through_turn
integer
cache_written_tokens

Tokens this request wrote to a new explicit cache (katara.cache).

integer
cache_ttl_seconds

How long that cache is kept.

integer
cache_storage_usdc

What keeping it costs, in USDC; included in cost_usdc.

string
simulated

On Test, a reply with fixed text that no model wrote, served when no Test provider was free.

boolean
stop_sequence

The stop sequence at which Katara ended the reply.

string
web_search

The searches this request was charged for.

object
requests

The successful searches; only those are charged, and none when the request ended without an answer.

integer
cost_usdc
string
cost_usd
string
model_calls

On a web search request, how many model calls it made.

integer
web_searches

Every search the model made, in order. Not on stream chunks, which carry each search as it runs.

Array<object>
object
id
required
string
query
required
string
results
required
Array<object>
object
url
string
title
string
page_age
string
content
string
error
string
Allowed values: invalid_input query_too_long too_many_requests unavailable max_uses_exceeded insufficient_quota
edit_id

On an image reply from a model that edits, the id to send as previous_edit_id.

string
Example
{
"object": "list",
"data": [
{
"object": "embedding"
}
],
"katara": {
"cost_usdc": "0.000018",
"cost_usd": "0.000018",
"billing_method": "credits",
"payment": {
"scheme": "upto",
"network": "eip155:43114",
"amount": "25000"
},
"web_searches": [
{
"error": "invalid_input"
}
]
}
}
PAYMENT-RESPONSE
string

On a call paid with x402, as for chat completions; amount is the charge.

A field the route does not take (unsupported_parameter, with param), a malformed request (invalid_request), a model that does not produce embeddings (feature_not_supported), or a credits key and a model its credits cannot pay for (model_requires_usdc).

Media typeapplication/json
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}

Unknown key (invalid_api_key).

Media typeapplication/json
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}

Without a key, a quote (with PAYMENT-REQUIRED) or a payment that does not verify (payment_invalid); with a credits key, insufficient_credits; with a USDC key whose balance cannot cover the call, insufficient_quota.

Media typeapplication/json
One of:
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
PAYMENT-REQUIRED
string

Base64 of the PaymentRequired object in the body. Present only on a quote.

Unknown model (model_not_found).

Media typeapplication/json
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}

An upto payment from a wallet that has not approved Permit2 and carries no permit (permit2_allowance_required).

Media typeapplication/json
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}

Too many unpaid quotes from one address (quote_rate_limited).

Media typeapplication/json
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
Retry-After
integer

The embeddings provider failed (provider_failed) or refused the request (provider_rejected_request). Nothing was charged.

Media typeapplication/json
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}

The model cannot be served right now (no_capacity). Retry after Retry-After.

Media typeapplication/json
object
error
required
object
message
required

For people. Wording may change.

string
type
required
string
Allowed values: invalid_request_error insufficient_quota rate_limit_error server_error
code
required

Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.

string
Allowed values: invalid_api_key model_not_found model_requires_x402 model_requires_usdc invalid_request invalid_value invalid_web_search context_length_exceeded feature_not_supported media_too_large insufficient_quota insufficient_credits funding_pending community_off account_suspended billing_suspended wrong_environment no_capacity upstream_timeout test_network_unavailable payment_invalid permit2_allowance_required quote_rate_limited unsupported_parameter provider_failed provider_output_invalid provider_rejected_request provider_rate_limited provider_overloaded request_too_large not_found method_not_allowed storage_unavailable internal_error
param
string | null
request_id

The response’s x-katara-request-id.

string
Example
{
"error": {
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
Retry-After
integer