KosmoKrator

data

Cohere CLI for AI Agents

Use the Cohere CLI from KosmoKrator to call Cohere tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Cohere CLI Setup

Cohere can be configured headlessly with `kosmokrator integrations:configure cohere`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure cohere --set api_key="$COHERE_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor cohere --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
api_key COHERE_API_KEY Secret secret yes API Key
client_name COHERE_CLIENT_NAME Text text no Client Name
url COHERE_URL URL url no API Base URL

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call cohere.cohere_chat '{"model":"example_model","messages":"example_messages","stream":true,"tools":"example_tools","documents":"example_documents","citation_options":"example_citation_options","response_format":"example_response_format","safety_mode":"example_safety_mode"}' --json
Provider shortcut
kosmo integrations:cohere cohere_chat '{"model":"example_model","messages":"example_messages","stream":true,"tools":"example_tools","documents":"example_documents","citation_options":"example_citation_options","response_format":"example_response_format","safety_mode":"example_safety_mode"}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs cohere --json
kosmo integrations:docs cohere.cohere_chat --json
kosmo integrations:schema cohere.cohere_chat --json
kosmo integrations:search "Cohere" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

cohere.cohere_chat

Generate a non-streaming response with Cohere v2 Chat. Supports messages, documents, tools, citations, JSON response format, safety mode, sampling controls, and reasoning configuration.

Read read
Parameters
model, messages, stream, tools, documents, citation_options, response_format, safety_mode, max_tokens, stop_sequences, temperature, seed, frequency_penalty, presence_penalty, k, p, logprobs, tool_choice, thinking, priority, strict_tools
Generic call
kosmo integrations:call cohere.cohere_chat '{"model":"example_model","messages":"example_messages","stream":true,"tools":"example_tools","documents":"example_documents","citation_options":"example_citation_options","response_format":"example_response_format","safety_mode":"example_safety_mode"}' --json
Shortcut
kosmo integrations:cohere cohere_chat '{"model":"example_model","messages":"example_messages","stream":true,"tools":"example_tools","documents":"example_documents","citation_options":"example_citation_options","response_format":"example_response_format","safety_mode":"example_safety_mode"}' --json

cohere.cohere_embed

Create Cohere v2 embeddings for texts, image data URIs, or mixed inputs. Use input_type to match the downstream task such as search_document, search_query, classification, clustering, or image.

Read read
Parameters
model, input_type, texts, images, inputs, max_tokens, output_dimension, embedding_types, truncate, priority
Generic call
kosmo integrations:call cohere.cohere_embed '{"model":"example_model","input_type":"example_input_type","texts":"example_texts","images":"example_images","inputs":"example_inputs","max_tokens":1,"output_dimension":1,"embedding_types":"example_embedding_types"}' --json
Shortcut
kosmo integrations:cohere cohere_embed '{"model":"example_model","input_type":"example_input_type","texts":"example_texts","images":"example_images","inputs":"example_inputs","max_tokens":1,"output_dimension":1,"embedding_types":"example_embedding_types"}' --json

cohere.cohere_rerank

Rerank a list of documents for a search query using Cohere v2 Rerank. Documents may be strings; structured data should be converted to YAML strings before calling.

Read read
Parameters
model, query, documents, top_n, max_tokens_per_doc, priority
Generic call
kosmo integrations:call cohere.cohere_rerank '{"model":"example_model","query":"example_query","documents":"example_documents","top_n":1,"max_tokens_per_doc":1,"priority":1}' --json
Shortcut
kosmo integrations:cohere cohere_rerank '{"model":"example_model","query":"example_query","documents":"example_documents","top_n":1,"max_tokens_per_doc":1,"priority":1}' --json

cohere.cohere_tokenize

Tokenize text with the tokenizer used by a Cohere model. Use this before budgeting prompts or debugging token boundaries.

Read read
Parameters
text, model
Generic call
kosmo integrations:call cohere.cohere_tokenize '{"text":"example_text","model":"example_model"}' --json
Shortcut
kosmo integrations:cohere cohere_tokenize '{"text":"example_text","model":"example_model"}' --json

cohere.cohere_detokenize

Convert Cohere model token IDs back to text with the tokenizer used by a specific model.

Read read
Parameters
tokens, model
Generic call
kosmo integrations:call cohere.cohere_detokenize '{"tokens":"example_tokens","model":"example_model"}' --json
Shortcut
kosmo integrations:cohere cohere_detokenize '{"tokens":"example_tokens","model":"example_model"}' --json

cohere.cohere_list_models

List Cohere models with optional pagination and endpoint/default filters.

Read read
Parameters
page_size, page_token, endpoint, default_only
Generic call
kosmo integrations:call cohere.cohere_list_models '{"page_size":1,"page_token":"example_page_token","endpoint":"example_endpoint","default_only":true}' --json
Shortcut
kosmo integrations:cohere cohere_list_models '{"page_size":1,"page_token":"example_page_token","endpoint":"example_endpoint","default_only":true}' --json

cohere.cohere_get_model

Get Cohere model metadata including compatible endpoints, deprecation state, context length, features, and sampling defaults.

Read read
Parameters
model
Generic call
kosmo integrations:call cohere.cohere_get_model '{"model":"example_model"}' --json
Shortcut
kosmo integrations:cohere cohere_get_model '{"model":"example_model"}' --json

cohere.cohere_create_embed_job

Start a Cohere embed job for a validated embed-input dataset. Use list/get embed job to track completion and read output_dataset_id.

Write write
Parameters
model, dataset_id, input_type, truncate, name
Generic call
kosmo integrations:call cohere.cohere_create_embed_job '{"model":"example_model","dataset_id":"example_dataset_id","input_type":"example_input_type","truncate":"example_truncate","name":"example_name"}' --json
Shortcut
kosmo integrations:cohere cohere_create_embed_job '{"model":"example_model","dataset_id":"example_dataset_id","input_type":"example_input_type","truncate":"example_truncate","name":"example_name"}' --json

cohere.cohere_list_embed_jobs

List Cohere embed jobs for the authenticated user.

Read read
Parameters
none
Generic call
kosmo integrations:call cohere.cohere_list_embed_jobs '{}' --json
Shortcut
kosmo integrations:cohere cohere_list_embed_jobs '{}' --json

cohere.cohere_get_embed_job

Get details for a Cohere embed job, including status and output_dataset_id when complete.

Read read
Parameters
job_id
Generic call
kosmo integrations:call cohere.cohere_get_embed_job '{"job_id":"example_job_id"}' --json
Shortcut
kosmo integrations:cohere cohere_get_embed_job '{"job_id":"example_job_id"}' --json

cohere.cohere_cancel_embed_job

Cancel an active Cohere embed job. Cohere may bill for work already processed, and partial results are not returned.

Write write
Parameters
job_id
Generic call
kosmo integrations:call cohere.cohere_cancel_embed_job '{"job_id":"example_job_id"}' --json
Shortcut
kosmo integrations:cohere cohere_cancel_embed_job '{"job_id":"example_job_id"}' --json

cohere.cohere_create_dataset

Upload a dataset file to Cohere. For embed jobs, use type=embed-input and a JSONL/CSV/TXT file that matches Cohere dataset rules.

Write write
Parameters
name, type, filename, content, eval_filename, eval_content, keep_original_file, skip_malformed_input, keep_fields, optional_fields, text_separator, csv_delimiter
Generic call
kosmo integrations:call cohere.cohere_create_dataset '{"name":"example_name","type":"example_type","filename":"example_filename","content":"example_content","eval_filename":"example_eval_filename","eval_content":"example_eval_content","keep_original_file":true,"skip_malformed_input":true}' --json
Shortcut
kosmo integrations:cohere cohere_create_dataset '{"name":"example_name","type":"example_type","filename":"example_filename","content":"example_content","eval_filename":"example_eval_filename","eval_content":"example_eval_content","keep_original_file":true,"skip_malformed_input":true}' --json

cohere.cohere_list_datasets

List Cohere datasets with optional datasetType, before, after, limit, and offset filters.

Read read
Parameters
datasetType, before, after, limit, offset
Generic call
kosmo integrations:call cohere.cohere_list_datasets '{"datasetType":"example_datasetType","before":"example_before","after":"example_after","limit":1,"offset":1}' --json
Shortcut
kosmo integrations:cohere cohere_list_datasets '{"datasetType":"example_datasetType","before":"example_before","after":"example_after","limit":1,"offset":1}' --json

cohere.cohere_get_dataset

Get a Cohere dataset by ID, including validation status, schema, dataset parts, and metrics.

Read read
Parameters
dataset_id
Generic call
kosmo integrations:call cohere.cohere_get_dataset '{"dataset_id":"example_dataset_id"}' --json
Shortcut
kosmo integrations:cohere cohere_get_dataset '{"dataset_id":"example_dataset_id"}' --json

cohere.cohere_delete_dataset

Delete a Cohere dataset by ID. Cohere also automatically expires datasets after its retention period.

Write write
Parameters
dataset_id
Generic call
kosmo integrations:call cohere.cohere_delete_dataset '{"dataset_id":"example_dataset_id"}' --json
Shortcut
kosmo integrations:cohere cohere_delete_dataset '{"dataset_id":"example_dataset_id"}' --json

cohere.cohere_get_dataset_usage

Get Cohere organization dataset storage usage in bytes.

Read read
Parameters
none
Generic call
kosmo integrations:call cohere.cohere_get_dataset_usage '{}' --json
Shortcut
kosmo integrations:cohere cohere_get_dataset_usage '{}' --json

cohere.cohere_create_audio_transcription

Transcribe an audio file with Cohere v2 Audio Transcriptions. Provide file content directly; supported extensions include flac, mp3, mpeg, mpga, ogg, and wav.

Read read
Parameters
filename, content, model, language, temperature
Generic call
kosmo integrations:call cohere.cohere_create_audio_transcription '{"filename":"example_filename","content":"example_content","model":"example_model","language":"example_language","temperature":1}' --json
Shortcut
kosmo integrations:cohere cohere_create_audio_transcription '{"filename":"example_filename","content":"example_content","model":"example_model","language":"example_language","temperature":1}' --json

cohere.cohere_classify

Classify text with Cohere v1 Classify. Upstream marks this endpoint deprecated; prefer newer chat or embedding workflows unless you need legacy classify compatibility.

Read read
Parameters
inputs, examples, model, truncate, preset
Generic call
kosmo integrations:call cohere.cohere_classify '{"inputs":"example_inputs","examples":"example_examples","model":"example_model","truncate":"example_truncate","preset":"example_preset"}' --json
Shortcut
kosmo integrations:cohere cohere_classify '{"inputs":"example_inputs","examples":"example_examples","model":"example_model","truncate":"example_truncate","preset":"example_preset"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

cohere.cohere_chat 21 parameters
Schema command
kosmo integrations:schema cohere.cohere_chat --json
ParameterTypeRequiredDescription
model string yes Cohere chat model ID, for example command-a-03-2025.
messages array yes Chronological chat messages with user, assistant, system, or tool roles.
stream boolean no Must be false or omitted. Streaming SSE is not supported by this tool.
tools array no Tool/function definitions available to the model.
documents array no Relevant documents as strings or objects for citation-aware generation.
citation_options object no Citation generation options.
response_format object no Response format control, such as json_object with optional JSON schema.
safety_mode string no Safety instruction mode for compatible models.
max_tokens integer no Maximum output tokens.
stop_sequences array no Up to five stop strings.
temperature number no Sampling temperature.
seed integer no Best-effort deterministic seed.
frequency_penalty number no Penalty for repeated token frequency.
presence_penalty number no Penalty for already-present tokens.
k integer no Top-k sampling control.
p number no Top-p sampling control.
logprobs boolean no Include token log probabilities when supported.
tool_choice string no Force tool use or direct response for compatible models.
thinking object no Reasoning feature configuration for supported models.
priority integer no Priority from 0 to 999, where lower values are handled earlier.
strict_tools boolean no Force tool calls to follow the supplied tool schema strictly.
cohere.cohere_embed 10 parameters
Schema command
kosmo integrations:schema cohere.cohere_embed --json
ParameterTypeRequiredDescription
model string yes Embedding model ID.
input_type string yes Embedding input type.
texts array no Text inputs to embed. Maximum 96 per call.
images array no Image data URI inputs. Maximum 1 image per call.
inputs array no Mixed text/image component inputs. Maximum 96 per call.
max_tokens integer no Maximum tokens to embed per input.
output_dimension integer no Output embedding dimension for embed-v4 and newer models.
embedding_types array no Embedding formats such as float, int8, uint8, binary, or ubinary.
truncate string no How to truncate inputs that exceed context.
priority integer no Priority from 0 to 999, where lower values are handled earlier.
cohere.cohere_rerank 6 parameters
Schema command
kosmo integrations:schema cohere.cohere_rerank --json
ParameterTypeRequiredDescription
model string yes Rerank model ID, for example rerank-v4.0-pro.
query string yes Search query.
documents array yes Documents to compare to the query. Cohere recommends no more than 1000 per call.
top_n integer no Maximum number of ranked results to return.
max_tokens_per_doc integer no Token truncation limit per document. Defaults to 4096 upstream.
priority integer no Priority from 0 to 999, where lower values are handled earlier.
cohere.cohere_tokenize 2 parameters
Schema command
kosmo integrations:schema cohere.cohere_tokenize --json
ParameterTypeRequiredDescription
text string yes Text to tokenize.
model string yes Model whose tokenizer should be used.
cohere.cohere_detokenize 2 parameters
Schema command
kosmo integrations:schema cohere.cohere_detokenize --json
ParameterTypeRequiredDescription
tokens array yes Token integer IDs to detokenize.
model string yes Model whose tokenizer should be used.
cohere.cohere_list_models 4 parameters
Schema command
kosmo integrations:schema cohere.cohere_list_models --json
ParameterTypeRequiredDescription
page_size number no Maximum models per page. Range: 1-1000. Default: 20.
page_token string no Token from next_page_token in a previous response.
endpoint string no Only return models compatible with this endpoint.
default_only boolean no Only return default models for the endpoint. Valid only when endpoint is provided.
cohere.cohere_get_model 1 parameters
Schema command
kosmo integrations:schema cohere.cohere_get_model --json
ParameterTypeRequiredDescription
model string yes Model name to retrieve.
cohere.cohere_create_embed_job 5 parameters
Schema command
kosmo integrations:schema cohere.cohere_create_embed_job --json
ParameterTypeRequiredDescription
model string yes Embedding model ID.
dataset_id string yes Validated embed-input dataset ID.
input_type string yes Embedding input type.
truncate string no How to truncate text that exceeds model limits.
name string no Optional embed job display name.
cohere.cohere_list_embed_jobs 0 parameters
Schema command
kosmo integrations:schema cohere.cohere_list_embed_jobs --json
ParameterTypeRequiredDescription
No parameters.
cohere.cohere_get_embed_job 1 parameters
Schema command
kosmo integrations:schema cohere.cohere_get_embed_job --json
ParameterTypeRequiredDescription
job_id string yes Embed job ID.
cohere.cohere_cancel_embed_job 1 parameters
Schema command
kosmo integrations:schema cohere.cohere_cancel_embed_job --json
ParameterTypeRequiredDescription
job_id string yes Embed job ID to cancel.
cohere.cohere_create_dataset 12 parameters
Schema command
kosmo integrations:schema cohere.cohere_create_dataset --json
ParameterTypeRequiredDescription
name string yes Dataset display name.
type string yes Dataset type, for example embed-input.
filename string yes Filename for the uploaded dataset.
content string yes Raw dataset file content.
eval_filename string no Optional evaluation filename.
eval_content string no Optional evaluation file content.
keep_original_file boolean no Store the original uploaded file.
skip_malformed_input boolean no Drop malformed rows instead of failing validation.
keep_fields array no Required fields to preserve.
optional_fields array no Optional fields to preserve.
text_separator string no Separator for raw text uploads.
csv_delimiter string no Delimiter for CSV uploads.
cohere.cohere_list_datasets 5 parameters
Schema command
kosmo integrations:schema cohere.cohere_list_datasets --json
ParameterTypeRequiredDescription
datasetType string no Optional dataset type filter. Use Cohere casing: datasetType.
before string no Return datasets before this ISO date-time.
after string no Return datasets after this ISO date-time.
limit number no Maximum number of results.
offset number no Offset into the result set.
cohere.cohere_get_dataset 1 parameters
Schema command
kosmo integrations:schema cohere.cohere_get_dataset --json
ParameterTypeRequiredDescription
dataset_id string yes Dataset ID.
cohere.cohere_delete_dataset 1 parameters
Schema command
kosmo integrations:schema cohere.cohere_delete_dataset --json
ParameterTypeRequiredDescription
dataset_id string yes Dataset ID to delete.
cohere.cohere_get_dataset_usage 0 parameters
Schema command
kosmo integrations:schema cohere.cohere_get_dataset_usage --json
ParameterTypeRequiredDescription
No parameters.
cohere.cohere_create_audio_transcription 5 parameters
Schema command
kosmo integrations:schema cohere.cohere_create_audio_transcription --json
ParameterTypeRequiredDescription
filename string yes Audio filename including extension.
content string yes Raw audio file bytes as a string from the host.
model string yes Transcription model ID, for example cohere-transcribe-03-2026.
language string yes ISO-639-1 language code, for example en.
temperature number no Optional sampling temperature between 0 and 1.
cohere.cohere_classify 5 parameters
Schema command
kosmo integrations:schema cohere.cohere_classify --json
ParameterTypeRequiredDescription
inputs array yes Texts to classify. Maximum 96.
examples array no Optional examples as objects with text and label. Not required for fine-tuned classify models.
model string no Optional fine-tuned Classify model ID.
truncate string no How to handle inputs longer than model limits.
preset string no Deprecated upstream preset parameter.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.