-
Notifications
You must be signed in to change notification settings - Fork 0
AI Module
Rajesh Gautam edited this page Jun 12, 2026
·
1 revision
pcAI is a built-in AI module — no import needed. It is available from the first line of any Curl program.
Get a free API key at openrouter.ai/keys, then:
export CURL_AI_KEY=sk-or-your_key_here
That's all. Curl defaults to DeepSeek via OpenRouter.
Ask a question. Conversation history is kept across calls.
var{reply, pcAI.ask{"What is the capital of France?"}}\
pcType{var{reply}}\
Start an interactive chat loop in the terminal. Type exit to quit.
pcAI.chat{""}\
Set a custom system prompt / persona. Resets conversation history.
pcAI.context{"You are a friendly pirate who speaks in rhymes."}\
var{reply, pcAI.ask{"What is 2 + 2?"}}\
pcType{var{reply}}\
Clear conversation history while keeping the current context.
pcAI.reset{""}\
var{summary, pcAI.summarize{"paste a long paragraph here"}}\
pcType{var{summary}}\
var{result, pcAI.analyze{"some data or text"}}\
pcType{var{result}}\
Returns one word: positive, negative, or neutral.
var{mood, pcAI.sentiment{"I love this!"}}\
pcType{var{mood}}\
var{translated, pcAI.translate{"Bonjour — translate to English"}}\
pcType{var{translated}}\
Override the default model with environment variables:
| Variable | Default | Description |
|---|---|---|
CURL_AI_KEY |
(required) | API key |
CURL_AI_BASE_URL |
https://openrouter.ai/api/v1 |
API base URL |
CURL_AI_MODEL |
deepseek/deepseek-chat-v3-0324 |
Model name |
export CURL_AI_KEY=your_openai_key
export CURL_AI_BASE_URL=https://api.openai.com/v1
export CURL_AI_MODEL=gpt-4o-mini
export CURL_AI_BASE_URL=http://localhost:11434/v1
export CURL_AI_MODEL=llama3.2
export CURL_AI_KEY=ollama
ollama pull hf.co/gautamritvik/Curl-Bot
export CURL_AI_BASE_URL=http://localhost:11434/v1
export CURL_AI_MODEL=hf.co/gautamritvik/Curl-Bot
export CURL_AI_KEY=ollama
- Conversation history is kept automatically across
pcAI.askcalls - History auto-compacts when it gets long (summarizes older messages)
- Use
pcAI.reset{""}\to clear history - Use
pcAI.context{...}\to change the bot's personality