Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Cohere

Scalekit connector
Open markdown

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

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. 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>
  3. Create the Cohere connection

    In AgentKit > Connections, create a Cohere connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. 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.actions
    const connector = 'cohere'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { 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 call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'cohere_connector_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each 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 to execute_tool
Try in PlaygroundRequest a tool
  • cohere_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-only

    Generate 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-only

    Get 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-only

    List 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-only

    Get 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-only

    List 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-only

    Get 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-only

    Rerank 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-only

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