CH·02CLI reference

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

Examples

# Embed a single string
deeprelay embeddings deeprelay/qwen3-embedding-8b "hello world"

# Embed several inputs in one call (one vector per argument)
deeprelay embeddings deeprelay/qwen3-embedding-8b "first sentence" "second sentence"

# Embed a file, one input per line
cat corpus.txt | deeprelay embeddings deeprelay/qwen3-embedding-8b

# Full vectors as JSON, saved to a file
deeprelay embeddings deeprelay/qwen3-embedding-8b "hello" -o json > vectors.json

# Request a narrower vector (only models supporting truncated embeddings)
deeprelay embeddings deeprelay/qwen3-embedding-8b "hello" --dimensions 1024

# List the embedding models you can call
deeprelay 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
deeprelay embeddings <model> [text...] [flags]

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 DEEPRELAY_API_BASE env) (default "https://api.deeprelay.ai/v1")
      --debug             Enable debug logging to stderr
      --no-preflight      Skip the plan/credit check before inference requests (override with DEEPRELAY_NO_PREFLIGHT env)
  -o, --output string     Output format: table|json (default table on TTY, json otherwise) (default "table")

SEE ALSO

  • deeprelay - deeprelay command-line interface

← The gpu CLI