The Cohere connector lets your AI agent act in each user's Cohere account. Each user connects their own Cohere access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 17 tools.
- Tools
- 17
- What they doRead · write · destructive
- 15 · 2 · 015 read2 write0 destructive
- Users sign in with
- Access token
Setup
Install the SDK
Terminal window npm install @scalekit-sdk/node dotenvTerminal window pip install scalekit-sdk-python python-dotenvSet your credentials
Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret>Create the Cohere connection
In AgentKit > Connections, create a Cohere connection. The name you give it is the
connection_nameyour code passes. See Configure connections.Authorize a user and make your first call
quickstart.mts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'import { createInterface } from 'node:readline/promises'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENVIRONMENT_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'cohere'const identifier = 'user_123'// Generate an authorization link for the userconst { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })console.log('Authorize Cohere:', link)const rl = createInterface({ input: process.stdin, output: process.stdout })await rl.question('Press Enter after authorizing...')rl.close()// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'cohere_connector_list',toolInput: {},})console.log(result)Terminal window npx tsx quickstart.mtsquickstart.py import osfrom scalekit import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "cohere"identifier = "user_123"# Generate an authorization link for the userlink_response = actions.get_authorization_link(connection_name=connection_name,identifier=identifier,)print("Authorize Cohere:", link_response.link)input("Press Enter after authorizing...")# Make your first callresult = actions.execute_tool(tool_input={},tool_name="cohere_connector_list",connection_name=connection_name,identifier=identifier,)print(result)Terminal window python quickstart.pyEach user opens the link once and enters their Cohere credentials there. See Authorize a user for the full flow and statuses.
Tools
Pass the exact name toexecute_toolcohere_chat_generateGenerate the next assistant message for a conversation with a Cohere chat model, optionally grounded in documents or with tools the model can call.Read-onlyGenerate Chat Response
Generate the next assistant message for a conversation with a Cohere chat model, optionally grounded in documents or with tools the model can call. Returns id, finish_reason, the assistant message (text content, tool_calls and citations) and token usage. Use this for text generation, question answering over supplied documents, structured JSON output or tool calling. The response is returned in one piece; streaming is not supported here.
Inputs
messagesarrayrequired- The conversation so far, oldest first. Each message has a role (system, user, assistant or tool) and content. Content is a string or a list of content blocks such as text blocks. Assistant messages may carry tool_calls, and tool messages answer them with the matching tool_call_id. Example: [{"role": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "Summarize the benefits of reranking in two sentences."}].
modelstringrequired- Name of the Cohere chat model to use. Get valid names from cohere_model_list with endpoint chat. Example: command-a-03-2025.
citation_modestring- How citations are generated when documents or tools are used: ENABLED, DISABLED, FAST, ACCURATE or OFF. Leave empty for the model default. Example: ACCURATE.one of
ENABLEDDISABLEDFASTACCURATEOFF documentsarray- Documents the model can read and cite in its answer. Each item is either a plain string or an object with a data object holding the document fields and an optional id. Not supported together with response_format. Example: [{"id": "doc1", "data": {"title": "Refund policy", "text": "Refunds are issued within 30 days."}}].
frequency_penaltynumber- Penalty from 0 to 1 on tokens in proportion to how often they already appeared, to reduce repetition. Leave empty for the default of 0. Example: 0.2.
kinteger- Top-k sampling: only the k most likely tokens are considered at each step, from 0 to 500. 0 disables top-k. Leave empty for the default of 0. Example: 40.
logprobsboolean- Set to true to include the log probabilities of the generated tokens in the response. Default false. Example: true.
max_tokensinteger- Maximum number of output tokens to generate. Leave empty for the model's maximum. If the limit is hit, finish_reason is MAX_TOKENS. Example: 500.
pnumber- Nucleus sampling: only the most likely tokens with total probability p are considered, from 0.01 to 0.99. Leave empty for the default of 0.75. Example: 0.75.
presence_penaltynumber- Penalty from 0 to 1 applied equally to every token that already appeared, to reduce repetition. Leave empty for the default of 0. Example: 0.2.
priorityinteger- Request priority: lower numbers are handled earlier and are less likely to be dropped under load. 0 is the highest and the default. Example: 0.
response_formatobject- Force the output format. Use {"type": "json_object"} for any JSON object, optionally with a json_schema the output must follow, or {"type": "text"}. When asking for JSON, also tell the model in a message to produce JSON. Not supported together with documents or tools. Example: {"type": "json_object", "json_schema": {"type": "object", "properties": {"name": {"type": "string"}}, "required": ["name"]}}.
safety_modestring- Safety instruction added to the prompt: CONTEXTUAL (default), STRICT or OFF. Newer models such as command-r7b-12-2024 accept only CONTEXTUAL and STRICT. Example: CONTEXTUAL.one of
CONTEXTUALSTRICTOFF seedinteger- Seed for best-effort deterministic sampling: the same seed and parameters should usually return the same reply. Example: 42.
stop_sequencesarray- Up to 5 strings that stop generation when the model produces one of them; the stop string is not included in the reply. Example: ["\n\n", "END"].
strict_toolsboolean- Set to true to make tool calls follow the tool definitions strictly. The first requests with a new set of tools take longer. Example: true.
temperaturenumber- Randomness of the output, from 0 to 1; a value above 1 is rejected. Lower is more deterministic. Leave empty for the default of 0.3. Example: 0.3.
thinking_token_budgetinteger- Maximum number of tokens the model may spend thinking before it answers. Only used with reasoning models; set thinking_type to enabled. Example: 2000.
thinking_typestring- Turn reasoning on or off for models that support it: enabled or disabled. Reasoning models think by default. Example: disabled.one of
enableddisabled tool_choicestring- Force or forbid tool use. REQUIRED makes the model call at least one tool (tools must be set); NONE makes it answer directly. Leave empty to let the model decide. Example: REQUIRED.one of
REQUIREDNONE toolsarray- Functions the model may call. Each tool is an object with type function and a function object holding name, description and parameters (a JSON Schema). When the model wants a tool, finish_reason is TOOL_CALL and the message has tool_calls. Example: [{"type": "function", "function": {"name": "get_weather", "description": "Get the weather for a city", "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}].
cohere_connector_getGet one Cohere connector by ID.Read-onlyGet Connector
Get one Cohere connector by ID. Returns the connector with id, name, url, description, excludes, auth_type, active, continue_on_failure and timestamps. Use this to check a connector's URL, auth type or whether it is active. Use cohere_connector_list to find connector IDs.
Inputs
connector_idstringrequired- ID of the connector. Get it from cohere_connector_list. Example: web-search-x7y8z9.
cohere_connector_listList the Cohere connectors in the organization, newest first.Read-onlyList Connectors
List the Cohere connectors in the organization, newest first. Returns connectors, each with id, name, url, description, active, auth_type and timestamps, plus total_count. Use this to find a connector ID. Use cohere_connector_get for one known connector.
Inputs
limitinteger- Maximum number of connectors to return, from 0 to 100. Leave empty for the default of 30. Example: 30.
offsetinteger- Number of connectors to skip, for paging. Leave empty for the default of 0. Example: 30.
cohere_dataset_getGet one dataset by ID.Read-onlyGet Dataset
Get one dataset by ID. Returns the dataset with id, name, dataset_type, validation_status, validation_error, schema, created_at and its parts with download URLs. Use this to check whether an uploaded dataset is validated, or to find the output of an embed job. Use cohere_dataset_list to find dataset IDs.
Inputs
dataset_idstringrequired- ID of the dataset. Get it from cohere_dataset_list or from output_dataset_id of an embed job. Example: my-embed-input-0a1b2c.
cohere_dataset_listList the datasets in the Cohere organization, optionally filtered by type, validation status or creation date.Read-onlyList Datasets
List the datasets in the Cohere organization, optionally filtered by type, validation status or creation date. Returns datasets with id, name, dataset_type, validation_status, created_at and their parts. Use this to find a dataset ID for an embed job or fine-tuning. Use cohere_dataset_get for one known dataset.
Inputs
afterstring- Return only datasets created after this date and time (ISO 8601). Example: 2025-01-01T00:00:00Z.
beforestring- Return only datasets created before this date and time (ISO 8601). Example: 2025-06-30T00:00:00Z.
dataset_typestring- Return only datasets of this type, such as embed-input or embed-result. Example: embed-input.one of
embed-inputembed-resultcluster-resultcluster-outliersreranker-finetune-inputsingle-label-classification-finetune-inputchat-finetune-inputmulti-label-classification-finetune-inputbatch-chat-inputbatch-openai-chat-inputbatch-embed-v2-inputbatch-chat-v2-input limitinteger- Maximum number of datasets to return. Example: 20.
offsetinteger- Number of datasets to skip, for paging. Example: 20.
validation_statusstring- Return only datasets with this validation status: unknown, queued, processing, failed, validated or skipped. Example: validated.one of
unknownqueuedprocessingfailedvalidatedskipped
cohere_dataset_usage_getGet the dataset storage used by the Cohere organization.Read-onlyGet Dataset Storage Usage
Get the dataset storage used by the Cohere organization. Returns organization_usage, the total bytes used. Each organization can store up to 10 GB. Use this to check remaining storage before uploading or generating more datasets.
Inputs
This tool takes no inputs.
cohere_documents_rerankScore and reorder a list of documents by how relevant each one is to a search query, using a Cohere Rerank model.Read-onlyRerank Documents
Score and reorder a list of documents by how relevant each one is to a search query, using a Cohere Rerank model. Returns results ordered from most to least relevant, each with the index of the document in the input list and a relevance_score from 0 to 1, plus relevant_spans when requested. Use this to improve the order of search or retrieval results before passing the best ones to cohere_chat_generate.
Inputs
documentsarrayrequired- Texts to rank against the query. Keep it to 1,000 or fewer; long texts are cut to max_tokens_per_doc. Format structured records as YAML strings for best results. Example: ["Refunds are issued within 30 days.", "Shipping takes 5 business days."].
modelstringrequired- Name of the Cohere rerank model. Get names from cohere_model_list with endpoint rerank. Example: rerank-v3.5.
querystringrequired- The search query to compare every document against. Example: What is the refund window?
max_tokens_per_docinteger- Documents longer than this many tokens are truncated. Leave empty for the default of 4096. Example: 4096.
priorityinteger- Request priority: lower numbers are handled earlier under load. 0 is the highest and the default. Example: 0.
relevant_spans_max_spansinteger- Maximum number of relevant spans per document when relevant spans are enabled. Leave empty to return all. Example: 3.
relevant_spans_modestring- Set to enabled to return the passages of each document that drove its score (Rerank v5 and newer models only). Example: enabled.one of
enableddisabled relevant_spans_thresholdnumber- Minimum relevance score for a span to be returned when relevant spans are enabled. Leave empty for the default of 0.1. Example: 0.1.
top_ninteger- Return only the top N results. Leave empty to return every document. Example: 3.
cohere_embed_job_getGet the status and details of one embed job.Read-onlyGet Embed Job
Get the status and details of one embed job. Returns job_id, name, status (processing, complete, cancelling, cancelled or failed), model, truncate, input_dataset_id, output_dataset_id and created_at. Use this to poll a job started with cohere_embed_job_create; when status is complete, read output_dataset_id with cohere_dataset_get.
Inputs
job_idstringrequired- ID of the embed job. Get it from cohere_embed_job_create or cohere_embed_job_list. Example: 9f8e7d6c-5b4a-3c2d-1e0f-a1b2c3d4e5f6.
cohere_embed_job_listList the embed jobs created in the Cohere organization.Read-onlyList Embed Jobs
List the embed jobs created in the Cohere organization. Returns embed_jobs, each with job_id, name, status, model, input_dataset_id, output_dataset_id and created_at. Use this to find a job ID or check recent jobs. Use cohere_embed_job_get for one known job.
Inputs
This tool takes no inputs.
cohere_embeddings_generateCreate embedding vectors for up to 96 texts or images with a Cohere Embed model.Read-onlyGenerate Embeddings
Create embedding vectors for up to 96 texts or images with a Cohere Embed model. Returns id, an embeddings object keyed by embedding type (float, int8 and so on) with one vector per input, the texts or images embedded, and billing meta. Use this for semantic search, clustering or classification features on small inputs. Use cohere_embed_job_create to embed a whole dataset asynchronously.
Inputs
input_typestringrequired- What the inputs are used for: search_document for texts stored in a search index, search_query for queries run against that index, classification, clustering, or image for image inputs. Example: search_document.one of
search_documentsearch_queryclassificationclusteringimage modelstringrequired- Name of the Cohere embedding model. Get names from cohere_model_list with endpoint embed. Example: embed-v4.0.
embedding_typesarray- Embedding formats to return: float, int8, uint8, binary, ubinary or base64. Leave empty to get float only. Example: ["float", "int8"].
imagesarray- Images to embed as data URIs (image/jpeg, image/png, image/webp or image/gif). Embed v3 models take 1 image of up to 5 MB per call; Embed v4 and newer take several, up to 20 MB in total. Set input_type to image. Example: ["data:image/png;base64,iVBORw0KGgo..."].
inputsarray- Mixed text and image inputs, up to 96 per call. Each input has a content list of text and image_url blocks, so one embedding can cover text and an image together. Example: [{"content": [{"type": "text", "text": "A red bicycle"}, {"type": "image_url", "image_url": {"url": "data:image/png;base64,iVBORw0KGgo..."}}]}].
max_tokensinteger- Maximum number of tokens to embed per input; longer inputs are cut according to truncate. Example: 512.
output_dimensioninteger- Size of each output vector, for embed-v4.0 and newer models only. Embed 4 takes 256, 512, 1024 or 1536. Embed 5 takes 256, 512, 768, 1024, 1536 or 2048 (default 2048). Leave empty for the model default. Example: 1024.one of
256512768102415362048 priorityinteger- Request priority: lower numbers are handled earlier under load. 0 is the highest and the default. Example: 0.
textsarray- Texts to embed, up to 96 per call. Provide texts, images or inputs. Example: ["Cohere builds enterprise language models.", "Reranking improves search relevance."].
truncatestring- How to handle inputs longer than the limit: END drops the end (default), START drops the start, NONE returns an error. Example: END.one of
NONESTARTEND
cohere_model_getGet the details of one Cohere model by name.Read-onlyGet Model
Get the details of one Cohere model by name. Returns name, endpoints, default_endpoints, context_length, tokenizer_url, features, sampling_defaults, finetuned and is_deprecated. Use this to check a model's context length, supported endpoints or deprecation status. Use cohere_model_list to browse models.
Inputs
modelstringrequired- Name of the model to look up. Get names from cohere_model_list. Example: command-a-03-2025.
cohere_model_listList the Cohere models available to the API key, optionally only those that work with one endpoint.Read-onlyList Models
List the Cohere models available to the API key, optionally only those that work with one endpoint. Returns a page of models, each with name, endpoints, context_length, features, finetuned and is_deprecated, plus next_page_token. Use this to find a valid model name for chat, embed, rerank or classify. Use cohere_model_get for one known model.
Inputs
default_onlyboolean- Set to true to return only the default model for the chosen endpoint. Only valid together with endpoint. Example: true.
endpointstring- Return only models compatible with this endpoint: chat, embed, classify, summarize, rerank, rate or generate. Example: chat.one of
chatembedclassifysummarizererankrategenerate page_sizeinteger- Maximum number of models per page, from 1 to 1000. Leave empty for the default of 20. Example: 50.
page_tokenstring- Token for the next page, copied from next_page_token in the previous response. Leave empty for the first page. Example: eyJvZmZzZXQiOjIwfQ.
cohere_text_classifyPredict which label fits each of up to 96 texts, from labeled examples or with a fine-tuned Cohere classification model.Read-onlyClassify Text
Predict which label fits each of up to 96 texts, from labeled examples or with a fine-tuned Cohere classification model. Returns id and one classification per input with the predicted label(s), confidence and the score for every label. Use this for sentiment, intent or topic labeling. Pass examples for few-shot classification, or a fine-tuned model ID that was trained on your labels.
Inputs
inputsarrayrequired- Texts to classify, up to 96 non-empty strings. Example: ["I love this product!", "The delivery was late."].
examplesarray- Labeled examples that show the model each class, each with a text and a label. Every label needs at least 2 examples; up to 2,500 examples in total, each up to 512 tokens. Not needed with a fine-tuned model. Example: [{"text": "Great service", "label": "positive"}, {"text": "Love it", "label": "positive"}, {"text": "Terrible", "label": "negative"}, {"text": "Very slow", "label": "negative"}].
modelstring- ID of a fine-tuned Cohere classification model. Leave empty when passing examples. Example: 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d-ft.
truncatestring- How to handle inputs longer than the model limit: END drops the end (default), START drops the start, NONE returns an error. Example: END.one of
NONESTARTEND
cohere_text_tokenizeSplit text into tokens with the tokenizer of a Cohere model.Read-onlyTokenize Text
Split text into tokens with the tokenizer of a Cohere model. Returns the list of token IDs and the matching token strings. Use this to count tokens against a model's context length or inspect how text is split. Use cohere_tokens_detokenize to turn token IDs back into text.
Inputs
modelstringrequired- Model whose tokenizer is used. Get names from cohere_model_list. Example: command-a-03-2025.
textstringrequired- Text to tokenize, from 1 to 65,536 characters. Example: Hello, how are you?
cohere_tokens_detokenizeConvert a list of token IDs back into text with the tokenizer of a Cohere model.Read-onlyDetokenize Tokens
Convert a list of token IDs back into text with the tokenizer of a Cohere model. Returns the text the tokens represent. Use this to read token IDs from cohere_text_tokenize or from log probabilities. Use the same model that produced the tokens.
Inputs
modelstringrequired- Model whose tokenizer produced the tokens. Example: command-a-03-2025.
tokensarrayrequired- Token IDs to convert to text. Example: [33555, 1114, 34].
cohere_embed_job_cancelCancel a running embed job.WriteCancel Embed Job
Cancel a running embed job. Returns an empty response on success. Embeddings processed before the cancel are still billed, and no partial results are kept. Use this to stop a job that is no longer needed. Use cohere_embed_job_get to confirm the status becomes cancelled.
Inputs
job_idstringrequired- ID of the embed job to cancel. Get it from cohere_embed_job_list. Example: 9f8e7d6c-5b4a-3c2d-1e0f-a1b2c3d4e5f6.
cohere_embed_job_createStart an asynchronous embed job that embeds every entry of a validated embed-input dataset.WriteCreate Embed Job
Start an asynchronous embed job that embeds every entry of a validated embed-input dataset. Returns the job_id. When the job completes, its output_dataset_id points to a new embed-result dataset with the texts and their embeddings. Use this for large corpora; use cohere_embeddings_generate for up to 96 inputs at once. Track progress with cohere_embed_job_get. The dataset must be of type embed-input with validation status validated; check it with cohere_dataset_get.
Inputs
dataset_idstringrequired- ID of a validated dataset of type embed-input. Get it from cohere_dataset_list. Example: my-embed-input-0a1b2c.
input_typestringrequired- What the texts are used for: search_document, search_query, classification, clustering or image. Example: search_document.one of
search_documentsearch_queryclassificationclusteringimage modelstringrequired- Embedding model to use. Example: embed-english-v3.0.
embedding_typesarray- Embedding formats to produce: float, int8, uint8, binary, ubinary or base64. Leave empty for float. Example: ["float"].
namestring- A name for the embed job, to recognize it later. Example: support-articles-2025-06.
truncatestring- How to handle texts longer than the model limit: END drops the end (default), START drops the start. Example: END.one of
STARTEND
No tools match.