gpu embeddings
Create text embeddings (vectors) for one or more inputs
Create text embeddings (vectors) for one or more inputs
Synopsis
Creates embeddings for one or more text inputs using a serverless embedding
model, over the OpenAI-compatible POST /v1/embeddings endpoint. The call is
always synchronous — embeddings have no streaming form. Requires a key with the
serverless:write scope.
Each trailing argument is one input. With no trailing arguments, inputs are
read from piped stdin, one input per line (blank lines are skipped) — so
cat corpus.txt | gpu embeddings returns one vector per line rather
than a single vector for the whole file.
The default table output prints one line per input with the vector's width and
a three-float preview; a full vector is thousands of floats and is not useful
on a terminal. Use -o json to get the complete response, including every
vector, for piping into a file or another program.
Billing is on input tokens only, at the model's listed input rate, rounded up
to the next whole cent per request — so every call is billed at least 1¢;
batch inputs into one call to pay the listed per-token rate. An embeddings
call emits no completion tokens, so the response's usage block carries
prompt_tokens and total_tokens only.
gpu embeddings <model> [text...] [flags]
Examples
# Embed a single string
gpu embeddings gpuai/qwen3-embedding-8b "hello world"
# Embed several inputs in one call (one vector per argument)
gpu embeddings gpuai/qwen3-embedding-8b "first sentence" "second sentence"
# Embed a file, one input per line
cat corpus.txt | gpu embeddings gpuai/qwen3-embedding-8b
# Full vectors as JSON, saved to a file
gpu embeddings gpuai/qwen3-embedding-8b "hello" -o json > vectors.json
# Request a narrower vector (only models supporting truncated embeddings)
gpu embeddings gpuai/qwen3-embedding-8b "hello" --dimensions 1024
# List the embedding models you can call
gpu models --modality embedding
Table output looks like:
[0] dims=4096 first3=[-0.019, 0.0071, -0.033]
[1] dims=4096 first3=[0.0042, -0.026, 0.011]
2 inputs, 9 prompt tokens
Options
--dimensions int Requested vector width; only models supporting truncated embeddings honour it
-h, --help help for embeddings
Options inherited from parent commands
--api-base string API base URL (override with GPUAI_API_BASE env) (default "https://api.gpu.ai/v1")
--debug Enable debug logging to stderr
-o, --output string Output format: table|json (default table on TTY, json otherwise)
Limits
- Up to 2048 inputs per request, bounded so the response stays under
400 before any processing.
encoding_formatsupportsfloatonly;base64is rejected with a
400 unsupported_parameter.
- A chat model id on this endpoint returns
404 model_not_found— the id is
SEE ALSO
- gpu - GPU.ai command-line interface
- gpu models - List and inspect serverless inference models