curl --request POST \
--url https://grid.x402compute.cc/v1/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"model": "embeddinggemma-2",
"input": [
"search query",
"document text"
],
"dimensions": 256,
"input_type": "query"
}
'{
"object": "list",
"data": [
{
"object": "embedding",
"index": 1,
"embedding": [
123
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 2,
"total_tokens": 2,
"cost_usd": 1,
"breakdown": {
"text": 1,
"image": 1,
"audio": 1,
"video": 1
}
},
"processor_revision": "<string>",
"embedding_protocol": "embedding-multimodal-v1",
"billing_pending": true,
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Create embeddings
OpenAI-compatible embeddings with input-only billing. Existing text models accept a string or string array. embeddinggemma-2 also accepts ordered text, image, audio, and video content parts and returns one normalized vector per top-level item. Omitted EG2 input_type defaults to query; unspecified explicitly opts out. Legacy omission retains each model’s existing behavior. The model is default off and is callable only when it appears in GET /v1/models?type=embedding. Authenticate with an X-API-Key carrying grid:write (prepaid credits), or omit it and retry the 402 challenge with X-Payment. EG2 input and results are persisted only as sealed envelopes. Terminal input becomes purge-eligible after 30 minutes and results after one hour; the hourly purge makes practical upper bounds about 90 minutes and two hours. Plaintext node error text is never persisted.
curl --request POST \
--url https://grid.x402compute.cc/v1/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"model": "embeddinggemma-2",
"input": [
"search query",
"document text"
],
"dimensions": 256,
"input_type": "query"
}
'{
"object": "list",
"data": [
{
"object": "embedding",
"index": 1,
"embedding": [
123
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 2,
"total_tokens": 2,
"cost_usd": 1,
"breakdown": {
"text": 1,
"image": 1,
"audio": 1,
"video": 1
}
},
"processor_revision": "<string>",
"embedding_protocol": "embedding-multimodal-v1",
"billing_pending": true,
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Headers
Compute/Grid API key with grid:write scope. Requests debit prepaid credits. Omit to use the x402 challenge.
"x402c_..."
x402 payment payload. Send after receiving the endpoint's 402 challenge.
Body
"embeddinggemma-2"
A single text string; 1-2048 strings for legacy text models; or 1-16 ordered string/structured items for EmbeddingGemma 2. Each item produces one vector at the matching response index.
1Optional model-specific output dimension. Omit for the model's native dimension. Unsupported model/dimension pairs return 400.
768, 512, 256, 128 Optional model-specific retrieval behavior. This schema intentionally has no global default.
query, document float standard, confidential Use an authenticated wallet session's credits when no API key is supplied.
Optional OpenAI-compatible caller identifier.
Response
One finite, unit-normalized float vector per input item, ordered by index.
list Show child attributes
Show child attributes
Show child attributes
Show child attributes
Present for EmbeddingGemma 2.
embedding-multimodal-v1 Present and true only when x402 capture succeeded but durable accounting finalization is still recovering. Do not resubmit the paid request.
Present with billing_pending so accounting recovery is correlated idempotently.
Was this page helpful?
