cohere-hello-world
Create a minimal working Cohere example with Chat, Embed, and Rerank. Use when starting a new Cohere integration, testing your setup, or learning basic Cohere API v2 patterns. Trigger with phrases like "cohere hello world", "cohere example", "cohere quick start", "simple cohere code".
Best use case
cohere-hello-world is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Create a minimal working Cohere example with Chat, Embed, and Rerank. Use when starting a new Cohere integration, testing your setup, or learning basic Cohere API v2 patterns. Trigger with phrases like "cohere hello world", "cohere example", "cohere quick start", "simple cohere code".
Teams using cohere-hello-world should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/cohere-hello-world/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How cohere-hello-world Compares
| Feature / Agent | cohere-hello-world | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Create a minimal working Cohere example with Chat, Embed, and Rerank. Use when starting a new Cohere integration, testing your setup, or learning basic Cohere API v2 patterns. Trigger with phrases like "cohere hello world", "cohere example", "cohere quick start", "simple cohere code".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Cohere Hello World
## Overview
Three minimal working examples: Chat completion, text embedding, and search reranking. Each demonstrates a core Cohere API v2 endpoint.
## Prerequisites
- Completed `cohere-install-auth` setup
- `cohere-ai` package installed
- `CO_API_KEY` environment variable set
## Instructions
### Example 1: Chat Completion
```typescript
import { CohereClientV2 } from 'cohere-ai';
const cohere = new CohereClientV2();
async function chat() {
const response = await cohere.chat({
model: 'command-a-03-2025',
messages: [
{ role: 'system', content: 'You are a helpful coding assistant.' },
{ role: 'user', content: 'Explain what a closure is in JavaScript in 2 sentences.' },
],
});
console.log(response.message?.content?.[0]?.text);
}
chat().catch(console.error);
```
### Example 2: Text Embedding
```typescript
async function embed() {
const response = await cohere.embed({
model: 'embed-v4.0',
texts: ['Cohere builds enterprise AI', 'LLMs power modern search'],
inputType: 'search_document',
embeddingTypes: ['float'],
});
const vectors = response.embeddings.float;
console.log(`Generated ${vectors.length} embeddings`);
console.log(`Dimensions: ${vectors[0].length}`);
}
embed().catch(console.error);
```
### Example 3: Search Reranking
```typescript
async function rerank() {
const response = await cohere.rerank({
model: 'rerank-v3.5',
query: 'What is machine learning?',
documents: [
'Machine learning is a subset of artificial intelligence.',
'The weather today is sunny and warm.',
'Deep learning uses neural networks with many layers.',
'I enjoy cooking Italian food on weekends.',
],
topN: 2,
});
for (const result of response.results) {
console.log(`[${result.relevanceScore.toFixed(3)}] ${result.index}`);
}
}
rerank().catch(console.error);
```
### Example 4: Streaming Chat
```typescript
async function streamChat() {
const stream = await cohere.chatStream({
model: 'command-a-03-2025',
messages: [
{ role: 'user', content: 'Write a haiku about APIs.' },
],
});
for await (const event of stream) {
if (event.type === 'content-delta') {
process.stdout.write(event.delta?.message?.content?.text ?? '');
}
}
console.log(); // newline
}
streamChat().catch(console.error);
```
## Python Equivalents
```python
import cohere
co = cohere.ClientV2()
# Chat
response = co.chat(
model="command-a-03-2025",
messages=[{"role": "user", "content": "Hello, Cohere!"}],
)
print(response.message.content[0].text)
# Embed
response = co.embed(
model="embed-v4.0",
texts=["Hello world", "Goodbye world"],
input_type="search_document",
embedding_types=["float"],
)
print(f"Vectors: {len(response.embeddings.float)}")
# Rerank
response = co.rerank(
model="rerank-v3.5",
query="best programming language",
documents=["Python is versatile", "Rust is fast", "SQL manages data"],
top_n=2,
)
for r in response.results:
print(f"[{r.relevance_score:.3f}] doc {r.index}")
```
## Output
- Chat: Text response from Command A model
- Embed: Float vectors (1024 dimensions for v4)
- Rerank: Sorted documents with relevance scores (0.0-1.0)
- Stream: Token-by-token text output via SSE
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `model is required` | Missing model param | Always pass `model` in API v2 |
| `embedding_types is required` | Missing for embed | Add `embeddingTypes: ['float']` |
| `invalid api token` | Bad CO_API_KEY | Check key at dashboard.cohere.com |
| `rate limit exceeded` | Too many trial requests | Wait 60s or upgrade key |
## Resources
- [Cohere Chat API](https://docs.cohere.com/reference/chat)
- [Cohere Embed API](https://docs.cohere.com/reference/embed)
- [Cohere Rerank API](https://docs.cohere.com/reference/rerank)
## Next Steps
Proceed to `cohere-local-dev-loop` for development workflow setup.Related Skills
exa-hello-world
Create a minimal working Exa search example with real results. Use when starting a new Exa integration, testing your setup, or learning basic search, searchAndContents, and findSimilar patterns. Trigger with phrases like "exa hello world", "exa example", "exa quick start", "simple exa search", "first exa query".
evernote-hello-world
Create a minimal working Evernote example. Use when starting a new Evernote integration, testing your setup, or learning basic Evernote API patterns. Trigger with phrases like "evernote hello world", "evernote example", "evernote quick start", "simple evernote code", "create first note".
elevenlabs-hello-world
Generate your first ElevenLabs text-to-speech audio file. Use when starting a new ElevenLabs integration, testing your setup, or learning basic TTS API patterns. Trigger: "elevenlabs hello world", "elevenlabs example", "elevenlabs quick start", "first elevenlabs TTS", "text to speech demo".
documenso-hello-world
Create a minimal working Documenso example. Use when starting a new Documenso integration, testing your setup, or learning basic document signing patterns. Trigger with phrases like "documenso hello world", "documenso example", "documenso quick start", "simple documenso code", "first document".
deepgram-hello-world
Create a minimal working Deepgram transcription example. Use when starting a new Deepgram integration, testing your setup, or learning basic Deepgram API patterns. Trigger: "deepgram hello world", "deepgram example", "deepgram quick start", "simple transcription", "transcribe audio".
databricks-hello-world
Create a minimal working Databricks example with cluster and notebook. Use when starting a new Databricks project, testing your setup, or learning basic Databricks patterns. Trigger with phrases like "databricks hello world", "databricks example", "databricks quick start", "first databricks notebook", "create cluster".
customerio-hello-world
Create a minimal working Customer.io example. Use when learning Customer.io basics, testing SDK setup, or creating your first identify + track integration. Trigger: "customer.io hello world", "first customer.io message", "test customer.io", "customer.io example", "customer.io quickstart".
cursor-hello-world
Create your first project using Cursor AI features: Tab, Chat, Composer, and Inline Edit. Triggers on "cursor hello world", "first cursor project", "cursor getting started", "try cursor ai", "cursor basics", "cursor tutorial".
coreweave-hello-world
Deploy a GPU workload on CoreWeave with kubectl. Use when running your first GPU job, testing inference, or verifying CoreWeave cluster access. Trigger with phrases like "coreweave hello world", "coreweave first deploy", "coreweave gpu test", "run on coreweave".
cohere-webhooks-events
Implement Cohere streaming event handling, SSE patterns, and connector webhooks. Use when building streaming UIs, handling chat/tool events, or registering Cohere connectors for RAG. Trigger with phrases like "cohere streaming", "cohere events", "cohere SSE", "cohere connectors", "cohere webhook".
cohere-upgrade-migration
Migrate from Cohere API v1 to v2 and upgrade SDK versions. Use when upgrading cohere-ai SDK, migrating from CohereClient to CohereClientV2, or handling breaking changes between API versions. Trigger with phrases like "upgrade cohere", "cohere migration", "cohere v1 to v2", "update cohere SDK", "cohere breaking changes".
cohere-security-basics
Apply Cohere security best practices for API key management and access control. Use when securing API keys, implementing key rotation, or auditing Cohere security configuration. Trigger with phrases like "cohere security", "cohere secrets", "secure cohere", "cohere API key security", "cohere key rotation".