← All integrations

Integration · Cohere

Cohere Prompt Management

Command R+ preambles and system prompts deserve the same rigour as your code. PromptForge gives you version control and a live API for every Cohere prompt.

Integration Example

PromptForge + Cohere in one file

Version, template, and serve Cohere prompts via REST API. Manage preambles and system prompts for Command R and Command R+ in PromptForge, update them live without redeploying.

  1. 1
  2. Fetch your versioned, interpolated prompt from the PromptForge REST API with a single fetch() call.
  3. 2
  4. Pass the returned content string directly to the Cohere SDK as the system prompt, no transformation needed.
  5. 3
  6. Update the prompt in the PromptForge dashboard anytime, running applications pick up the change on the next request. No redeployment required.
integration.ts
TypeScript
import { CohereClientV2 } from "cohere-ai";

const cohere = new CohereClientV2({ token: process.env.COHERE_API_KEY });

async function fetchPrompt(role: string, brand: string) {
  const res = await fetch(
    "https://www.promptforge-app.com/api/v1/prompts/your-prompt-id",
    {
      method: "POST",
      headers: {
        Authorization: "Bearer pfk_your_api_key",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        version: "latest",
        variables: { role, brand },
      }),
    }
  );
  const { content } = await res.json();
  return content as string;
}

// Prompt template in PromptForge (e.g.):
//   You are a {{role}} agent for {{brand}}. Help the customer.
// 1. Fetch the system prompt with dynamic variables
const content = await fetchPrompt("customer_support", "Acme");

// 2. Use the versioned preamble with Command R+
//    The system message shapes how Command R+ handles grounding
//    and tool use, keep it versioned and out of your source code
const response = await cohere.chat({
  model: "command-r-plus",
  system: content,
  messages: [
    { role: "user", content: "How do I reset my Acme account password?" },
  ],
});

console.log(response.message.content?.[0].text);
How It Works

Cohere + PromptForge in Three Steps

Add a prompt management layer to your Cohere integration without refactoring your application.

Step 1

Write your Command R+ system prompt template

Cohere's system parameter sets the model's persona, grounding rules, and response style. Write it in PromptForge with {{role}}, {{brand}}, or {{tone}} variables for reuse across multiple product surfaces.

Step 2

Version independently from application code

Cohere regularly releases new model versions (Command R, Command R+, Command R7B). PromptForge lets you tune and version system prompts for each model independently, with full diff history for every change.

Step 3

Fetch and inject at request time

Retrieve the prompt via the PromptForge REST API and pass it as the `system` parameter to `cohere.chat()`. Change the prompt in the dashboard; all running applications receive the update on their next request, no redeploy needed.

Features

Powerful Prompt Management Features for AI Developers

From simple prompt storage to production-ready APIs with version control, dynamic variables, rollback, and a public gallery.

Dynamic Variables

Use {{variable}} syntax to create reusable prompt templates. Pass different values via API for endless customization across any LLM.

Instant Prompt API

RESTful API endpoint ready in seconds. Fetch any prompt with version pinning and variable interpolation. No redeployment needed.

Rollback with Diff Checker

View a line-by-line diff of every change and roll back to any previous version in one click. Never lose a working prompt again.

Publish to Gallery

Share your best prompts with the community in the public gallery. Get discovered by other developers and grow your personal library.

Start for free, upgrade anytime

No credit card required to get started. Paid plans include a 14-day free trial.

HobbyNo credit card
  • 1k API requests/month
  • 1 prompt
  • Unlimited versions
  • Dynamic variables
  • Version pinning
  • API key management
Start Managing My Prompts
Starter
14-day free trial
$9/month

No charge until your trial ends

  • 10k API requests/month
  • 5 prompt
  • Unlimited versions
  • Dynamic variables
  • Version pinning
  • API key management
Start 14-day Free Trial
Most Popular
Pro
14-day free trial
$29/month

No charge until your trial ends

  • 100k API requests/month
  • 25 prompt
  • Unlimited versions
  • Dynamic variables
  • Version pinning
  • API key management
Start 14-day Free Trial
Business
14-day free trial
$49/month

No charge until your trial ends

  • 500k API requests/month
  • 100 prompt
  • Unlimited versions
  • Dynamic variables
  • Version pinning
  • API key management
Start 14-day Free Trial

Questions? Contact us

FAQ

Cohere + PromptForge: Common Questions

Specific answers for developers integrating PromptForge with Cohere.

How do I use PromptForge with Cohere's RAG (Retrieval-Augmented Generation)?

Cohere's RAG uses `documents` passed to the chat endpoint alongside the system message. The system message instructs the model how to use those documents. Store and version that instruction in PromptForge. Your document retrieval pipeline (embedding + search) remains in application code. Fetch the PromptForge system prompt at request time, retrieve your documents as usual, then pass both to `cohere.chat({ system: content, documents: [...] })`.

Can I manage prompts for Command R and Command R+ separately in PromptForge?

Yes, and it is recommended since the two models have different capability profiles. Create a PromptForge prompt for each, for example, `cohere-command-r-triage` and `cohere-command-r-plus-analyst`. Each has its own version history. Your application code selects the right prompt ID based on which model you are calling, keeping prompt management and model selection as separate concerns.

Does PromptForge support Cohere's chat `preamble` parameter (v1 API)?

Yes. The v1 `preamble` parameter and the v2 `system` parameter both accept plain text strings, exactly what PromptForge returns. If you are on the v1 API, fetch the prompt from PromptForge and pass it to `preamble: content`. If you have migrated to v2, pass it to `system: content`. The PromptForge template itself does not change between API versions.

How do I version prompts used with Cohere's connector grounding?

When using Cohere connectors, the system message controls how the model synthesises connector results into its response. This instruction text changes far more frequently than the connector configuration itself. Store the synthesis instruction in PromptForge and version it independently. The connector ID and configuration stay in your application code, while the natural-language grounding instructions live in PromptForge where they can be updated without a deployment.