deeprelay chat
Run a chat completion (streams tokens by default)
Run a chat completion (streams tokens by default)
Synopsis
Runs a chat completion against a serverless model and streams the response
tokens to stdout. The prompt comes from -m/--message flags, trailing
arguments, or piped stdin (in that order). For a model whose catalog entry lists
an economy tier, append :economy to the model id to use it (no model lists one
today, and an unlisted :economy id returns model_not_found). Requires a key
with the serverless:write scope.
Chat writes the model's text to stdout. Use --no-stream to print the full
response at once.
Tool calling
--tool registers a function the model may call, and is repeatable. The value
is inline JSON or @file.json, and may be either the full OpenAI wrapper
({"type":"function","function":{…}}) or just the bare function object — both
are accepted because both are what you tend to have on hand. A file holding a
JSON array loads every tool in it from one flag.
--tool-choice takes none, auto, required, a bare function name, or a
literal JSON object. A bare name expands to the object form for you. A few
models restrict the mode: deeprelay/glm-5.3 accepts only auto (or no
--tool-choice), and any other mode is refused with a 400 naming the modes
it accepts.
Tool calls are printed after the reply text. Under --output json they are
emitted as the raw OpenAI tool_calls array, ready to feed straight back into
your own dispatcher; otherwise the arguments are re-indented for reading.
The model returns the call — it does not execute anything. Running the function
and sending the result back as a role: "tool" message is your loop to close;
see docs/serverless-inference.md for the round trip.
Not every model supports tools. Check for tools in supported_parameters:
deeprelay models get deeprelay/deepseek-v4-pro
Structured output, reasoning and sampling
| Flag | Sends | Notes | |
|---|---|---|---|
--response-format json_object | response_format: {"type":"json_object"} | The reply is a JSON object. | |
--json-schema | |||
--strict | json_schema.strict: true | Only with --json-schema. | |
--reasoning-effort | reasoning_effort | Sent verbatim (e.g. low, medium, high); the server decides what each model accepts. | |
--presence-penalty , --frequency-penalty | presence_penalty, frequency_penalty | Sent only when passed, so 0 is sent if you pass 0. | |
--seed | seed | Best-effort reproducibility. | |
--logprobs, --top-logprobs | logprobs, top_logprobs | --top-logprobs turns --logprobs on. | |
--no-parallel-tool-calls | parallel_tool_calls: false | At most one tool call per turn. |
Not every model supports every field, and the two kinds of field fail differently:
- Semantic parameters (
response_format,logprobs,top_logprobs) change what comes back. A model that cannot honour one refuses the request with a400naming the models that do support it, rather than quietly returning something else. - Hints (
reasoning_effort, the penalties,seed,parallel_tool_calls) are forwarded where the model honours them and dropped otherwise. A drop or downgrade is reported in thex-deeprelay-ignored-paramsresponse header, which chat prints to stderr:
note: server ignored: reasoning_effort
When the server reports what the call charged (usage.cost), chat prints it
to stderr after the reply as cost: $, exactly as the server sent it.
Both lines go to stderr, so stdout holds only the model's reply and stays safe
to pipe. --output json suppresses them.
Examples
# One-shot prompt as arguments (streams the reply)
deeprelay chat deeprelay/deepseek-v4.1-flash "Explain recursion in one sentence"
# System prompt + sampling controls
deeprelay chat deeprelay/deepseek-v4.1-flash -m "Write a haiku about GPUs" --system "You are concise." --temperature 0.7
# Pipe the prompt in from stdin
echo "Summarize recursion." | deeprelay chat deeprelay/deepseek-v4.1-flash
# Non-streaming (print the full response at once)
deeprelay chat deeprelay/deepseek-v4.1-flash "hi" --no-stream
# Offer the model a tool
deeprelay chat deeprelay/deepseek-v4-pro "What is the weather in Paris?" \
--tool '{"name":"get_weather","description":"Current weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}'
# Load a whole toolset from a file and force one specific call
deeprelay chat deeprelay/deepseek-v4.1-flash "Book me a table" \
--tool @tools.json --tool-choice make_reservation
# JSON that matches a schema, written straight to a file (cost goes to stderr)
deeprelay chat deeprelay/deepseek-v4.1-flash "Extract the city from: I live in Paris" \
--json-schema @city.schema.json --strict > city.json
# Plain JSON mode, more reasoning, reproducible sampling
deeprelay chat deeprelay/gpt-oss-120b "List three primes as JSON" \
--response-format json_object --reasoning-effort high --seed 7
# Machine-readable calls to pipe into your own dispatcher
deeprelay chat deeprelay/gpt-oss-120b "weather in Paris?" \
--tool @tools.json --output json | jq '.[0].function.arguments'
deeprelay chat <model> [prompt...] [flags]
Options
--frequency-penalty float Frequency penalty (-2.0 to 2.0)
-h, --help help for chat
--json-schema string JSON Schema the reply must match, inline or @file.json (implies --response-format json_schema)
--logprobs Request token log probabilities
--max-tokens int Maximum completion tokens
-m, --message stringArray User message (repeatable); alternative to a positional prompt
--no-parallel-tool-calls Ask the model for at most one tool call per turn (parallel_tool_calls: false)
--no-stream Disable streaming; print the full response
--presence-penalty float Presence penalty (-2.0 to 2.0)
--reasoning-effort string Reasoning effort hint, sent verbatim (e.g. low | medium | high)
--response-format string Structured output: json_object | json_schema (json_schema needs --json-schema)
--seed int Sampling seed, for best-effort reproducible output
--strict Ask for strict schema adherence (only with --json-schema)
--system string Optional system prompt
--temperature float Sampling temperature
--tool stringArray Function tool as JSON, or @file.json (repeatable). Accepts a bare function object or a full {"type":"function",...} wrapper
--tool-choice string none | auto | required | a function name | a JSON object
--top-logprobs int Most likely alternatives to return per token (0-20); implies --logprobs
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