Send chat completions to any Gumloop-supported model from the terminal.
gumloop chat completions create is the terminal counterpart of the Python SDK call client.chat.completions.create(...). Every flag maps 1:1 to the matching SDK kwarg.
Create a completion
gumloop chat completions create "Capital of Canada?" -m claude-sonnet-4-5
By default, output streams to your terminal when stdout is a TTY. When it isn’t, for example when piped to a file or another command, the CLI buffers the output into a single response. Pass --stream or --no-stream to be explicit. A structured request can also set stream; explicit flags take precedence.
Flag
Description
-m, --model
Required. Model slug (for example claude-sonnet-4-5, gpt-4o-mini, gemini-2.5-pro). Chat needs a concrete model, so gumloop-chew (the Autorouter) isn’t valid here. Preview a choice with POST /models/route first, then complete.
-s, --system
System message prepended to the conversation. Repeatable.
--message-stdin -
Read the user message from stdin instead of the positional argument.
--max-completion-tokens
Cap on completion tokens.
--temperature
Sampling temperature.
--modality
Output modality. Repeatable, for example --modality image --modality text for image-generation models.
--schema-file
Path to a JSON Schema file. Sent as response_format={"type": "json_schema", ...} for structured output.
--schema-name
Name to attach to the schema (defaults to schema).
--args-file, --args-json, --args -
Full SDK request as a JSON object, from a file, inline JSON, or stdin. Choose one source.
--stream / --no-stream
Force or suppress streaming. When neither a flag nor the request JSON specifies streaming, streams only if stdout is a TTY and --json is absent. Explicit flags override the request JSON.
--json
Print the response as JSON. With --stream, emits newline-delimited JSON (one chunk per line).
Pipe from stdin
cat draft.md | gumloop chat completions create -m claude-sonnet-4-5 \ --message-stdin - \ --system "Summarize the input in three bullets."
Structured output
gumloop chat completions create "Return JSON with the capital of Canada." \ -m claude-sonnet-4-5 \ --schema-file ./capital.schema.json \ --schema-name capital \ --json
gumloop chat completions create "A red maple leaf on white" \ -m gpt-image-2.5-flare \ --modality image --modality text \ --json
The response carries one or more image attachments on choices[0].message.images. Each entry is a data URL the caller can decode or render directly.Human output prints text. Use --json to retain images, including choices[0].delta.images in streamed chunks. Image generation options belong in image_config in a structured request.
Structured requests and vision
--args-file accepts the SDK’s full request shape: conversation history, multimodal message content, tool definitions and tool results, reasoning options, and provider-supported generation settings. Explicit command flags override corresponding request fields. Check the selected model’s supported inputs and outputs.
Replace the placeholders with a vision-capable model ID and an encoded image. Vision analyzes an input image. Text-to-image generation uses an image-capable model and the image output modalities described above.Reference-image editing additionally requires the backend image-input adapter and a supported image-generation model. Supply inline base64 image_url content with image output modalities. Remote image URLs and storage paths are refused by that adapter; MIME, decoded size, and model limits apply. This capability depends on backend deployment rather than the CLI installation alone.
Streaming with machine output
--stream --json emits ndjson, one full chat.completion.chunk per line, so consumers can stitch deltas without re-parsing the full SSE wire format.
gumloop chat completions create "stream me" -m claude-sonnet-4-5 --stream --json
Without an explicit streaming setting, the CLI streams to TTYs and uses unary output for redirects and pipes.
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.