Add your Cohere API key in Settings
| Field | Type | Required | Description |
|---|---|---|---|
| apiKey | password | Required | Your Cohere API key |
Add provider:
npx webinfer provider add cohere --key YOUR_API_KEYTest connection:
npx webinfer provider test cohereGet your API key from https://dashboard.cohere.com/
Basic usage:
import { generateText } from "webinfer"
// WebInfer automatically routes to the best available provider
const result = await generateText({
prompt: "Write a haiku about programming"
})
console.log(result.text)Specify Cohere explicitly:
import { generateText } from "webinfer"
const result = await generateText({
prompt: "Write a haiku about programming",
provider: "cohere"
})
console.log(result.text)
console.log("Provider:", result.provider)
console.log("Model:", result.model)Streaming:
import { streamText } from "webinfer"
const { textStream } = await streamText({
prompt: "Write a story about AI",
provider: "cohere"
})
for await (const chunk of textStream) {
process.stdout.write(chunk)
}embed-english-v3.0embed-english-v3.0Best for English textembed-multilingual-v3.0Best for multilingual textembed-english-light-v3.0Lightweight English modelembed-multilingual-light-v3.0Lightweight multilingual model