Answers from the documentation; checking which model is on duty
Hi - I answer from the OpenSmartRoute documentation: routing, the API, plans and quotas, self-hosting. Ask away, or open a support ticket if you need a person.
Grounded in the docs - follow a source before acting on it.
pywayne-llm-chat-bot - Skill - OpenSmartRoute
Skillv1.0.0
pywayne-llm-chat-bot
LLM chat interface using OpenAI-compatible APIs with streaming support and session management. Use when working with pywayne.llm.chat_bot module for creating LLM chat instances with custom…
Imported from wangyendt/wayne-skills (pywayne/llm/chat-bot/SKILL.md). Install upstream with npx skills add wangyendt/wayne-skills --skill chat-bot. Copyright stays with the author.
Pywayne LLM Chat Bot
This module provides a synchronous LLM chat interface compatible with OpenAI APIs (including local servers like Ollama).
# Use chat() for history trackingfor token in chat.chat("What is a class in Python?"): print(token, end='', flush=True)# Continuation - remembers previous contextfor token in chat.chat("How do I define a constructor?"): print(token, end='', flush=True)# View historyfor msg in chat.history: print(f"{msg['role']}: {msg['content']}")# Clear historychat.clear_history()
Configuration
LLMConfig Class
from pywayne.llm.chat_bot import LLMConfigconfig = LLMConfig( base_url="https://api.example.com/v1", api_key="your_api_key", model="deepseek-chat", temperature=0.7, max_tokens=8192, top_p=1.0, frequency_penalty=0.0, presence_penalty=0.0, system_prompt="You are a helpful assistant")chat = LLMChat(**config.to_dict())
Dynamic System Prompt Update
chat.update_system_prompt("You are now a Python expert, provide code examples")
Managing Multiple Sessions
from pywayne.llm.chat_bot import ChatManagermanager = ChatManager( base_url="https://api.example.com/v1", api_key="your_api_key", model="deepseek-chat", timeout=300 # Session timeout in seconds)# Get or create chat instance (maintains per-session history)chat1 = manager.get_chat("user1")chat2 = manager.get_chat("user2")# Sessions are independentchat1.chat("Hello from user1")chat2.chat("Hello from user2")# Remove a sessionmanager.remove_chat("user1")
Custom Configuration per Session
custom_config = LLMConfig( base_url=base_url, api_key=api_key, model="deepseek-chat", temperature=0.9, system_prompt="You are a creative writer")chat3 = manager.get_chat("user3", config=custom_config)
API Reference
LLMChat
Method
Description
ask(prompt, stream=False)
Single-turn conversation without history
chat(prompt, stream=True)
Multi-turn conversation with history tracking
update_system_prompt(prompt)
Update system prompt in-place
clear_history()
Clear conversation history (keeps system prompt)
history (property)
Get copy of current conversation history
ChatManager
Method
Description
get_chat(chat_id, stream=True, config=None)
Get or create chat instance by ID
remove_chat(chat_id)
Remove chat session
Parameters
Parameter
Default
Description
base_url
required
API base URL (e.g., https://api.deepseek.com/v1)
api_key
required
API authentication key
model
"deepseek-chat"
Model name
temperature
0.7
Controls randomness (0-2)
max_tokens
2048/8192
Maximum output tokens
top_p
1.0
Nucleus sampling (0-1)
frequency_penalty
0.0
Reduces repetition (-2 to 2)
presence_penalty
0.0
Encourages new topics (-2 to 2)
system_prompt
"你是一个严谨的助手"
System message
timeout
inf
Session timeout in seconds (ChatManager only)
Installed into a catalogue, chosen by a router
Install pywayne-llm-chat-bot and it becomes one more candidate the router can pick - when it fits.
A listing is a routing target with a manifest: what it does, which domains it covers, what it costs and who publishes it. Once installed it sits beside your own models and tools, is scored like any other candidate for each request, and shows up in the trace when it wins. Ratings come from workspaces that installed it, one per account.
When a provider is down or over quota the request moves on; the trace says it did.
Use it
Copy one of these into your project. Installing also returns the manifest and these snippets.
# after Install: the listing is in your workspace's routing pool - a plan picks it for its slotcurl-s-X POST https://api.opensmartroute.ai/api/v1/route -H 'Authorization: Bearer $OSR_API_KEY' -H 'Content-Type: application/json' -d '{"text": "...", "plan": true}'
Manifest
An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.
wangyendt-wayne-skills-chat-bot.ocm.jsonjson
{
"ocm": "1",
"id": "wangyendt-wayne-skills-chat-bot",
"kind": "skill",
"name": "pywayne-llm-chat-bot",
"description": "LLM chat interface using OpenAI-compatible APIs with streaming support and session management. Use when working with pywayne.llm.chat_bot module for creating LLM chat instances with custom configuration, managing multi-turn conversations with history, handling streaming responses, or managing multiple chat sessions with ChatManager",
"publisher": "wangyendt",
"version": "1.0.0",
"capabilities": {
"domains": [
"coding",
"general_chat"
],
"tags": [
"skill-md",
"skills-sh"
],
"languages": [
"en"
]
},
"quality_prior": 0.6,
"examples": [
"LLM chat interface using OpenAI-compatible APIs with streaming support and session management. Use when working with pywayne.llm.chat_bot module for creating LLM chat instances with custom configuration, managing multi-turn conversations with history, handling streaming responses, or managing multiple chat sessions with ChatManager"
],
"primary": false,
"metadata": {
"source": {
"provider": "skills.sh",
"repository": "https://github.com/wangyendt/wayne-skills",
"path": "pywayne/llm/chat-bot/SKILL.md",
"ref": "HEAD",
"url": "https://github.com/wangyendt/wayne-skills/blob/HEAD/pywayne/llm/chat-bot/SKILL.md",
"key": "wangyendt/wayne-skills/pywayne/llm/chat-bot/SKILL.md"
}
},
"instructions": "# Pywayne LLM Chat Bot\n\nThis module provides a synchronous LLM chat interface compatible with OpenAI APIs (including local servers like Ollama).\n\n## Quick Start\n\n```python\nfrom pywayne.llm.chat_bot import LLMChat\n\n# Create chat instance\nchat = LLMChat(\n base_url=\"https://api.example.com/v1\",\n api_key=\"your_api_key\",\n model=\"deepseek-chat\"\n)\n\n# Single-turn conversation (non-streaming)\nresponse = chat.ask(\"Hello, LLM!\", stream=False)\nprint(response)\n\n# Streaming response\nfor token in chat.ask(\"Explain recursion\", stream=True):\n print(token, end='', flush=True)\n```\n\n## Multi-turn Conversation\n\n```python\n# Use chat() for history tracking\nfor token in chat.chat(\"What is a class in Python?\"):\n print(token, end='', flush=True)\n\n# Continuation - remembers previous context\nfor token in chat.chat(\"How do I define a constructor?\"):\n print(token, end='', flush=True)\n\n# View history\nfor msg in chat.history:\n print(f\"{msg['role']}: {msg['content']}\")\n\n# Clear history\nchat.clear_history()\n```\n\n## Configuration\n\n### LLMConfig Class\n\n```python\nfrom pywayne.llm.chat_bot import LLMConfig\n\nconfig = LLMConfig(\n base_url=\"https://api.example.com/v1\",\n api_key=\"your_api_key\",\n model=\"deepseek-chat\",\n temperature=0.7,\n max_tokens=8192,\n top_p=1.0,\n frequency_penalty=0.0,\n presence_penalty=0.0,\n system_prompt=\"You are a helpful assistant\"\n)\n\nchat = LLMChat(**config.to_dict())\n```\n\n### Dynamic System Prompt Update\n\n```python\nchat.update_system_prompt(\"You are now a Python expert, provide code examples\")\n```\n\n## Managing Multiple Sessions\n\n```python\nfrom pywayne.llm.chat_bot import ChatManager\n\nmanager = ChatManager(\n base_url=\"https://api.example.com/v1\",\n api_key=\"your_api_key\",\n model=\"deepseek-chat\",\n timeout=300 # Session timeout in seconds\n)\n\n# Get or create chat instance (maintains per-session history)\nchat1 = manager.get_chat(\"user1\")\nchat2 = manager.get_chat(\"user2\")\n\n# Sessions are independent\nchat1.chat(\"Hello from user1\")\nchat2.chat(\"Hello from user2\")\n\n# Remove a session\nmanager.remove_chat(\"user1\")\n```\n\n### Custom Configuration per Session\n\n```python\ncustom_config = LLMConfig(\n base_url=base_url,\n api_key=api_key,\n model=\"deepseek-chat\",\n temperature=0.9,\n system_prompt=\"You are a creative writer\"\n)\n\nchat3 = manager.get_chat(\"user3\", config=custom_config)\n```\n\n## API Reference\n\n### LLMChat\n\n| Method | Description |\n|--------|-------------|\n| `ask(prompt, stream=False)` | Single-turn conversation without history |\n| `chat(prompt, stream=True)` | Multi-turn conversation with history tracking |\n| `update_system_prompt(prompt)` | Update system prompt in-place |\n| `clear_history()` | Clear conversation history (keeps system prompt) |\n| `history` (property) | Get copy of current conversation history |\n\n### ChatManager\n\n| Method | Description |\n|--------|-------------|\n| `get_chat(chat_id, stream=True, config=None)` | Get or create chat instance by ID |\n| `remove_chat(chat_id)` | Remove chat session |\n\n## Parameters\n\n| Parameter | Default | Description |\n|-----------|---------|-------------|\n| `base_url` | required | API base URL (e.g., `https://api.deepseek.com/v1`) |\n| `api_key` | required | API authentication key |\n| `model` | `\"deepseek-chat\"` | Model name |\n| `temperature` | `0.7` | Controls randomness (0-2) |\n| `max_tokens` | `2048`/`8192` | Maximum output tokens |\n| `top_p` | `1.0` | Nucleus sampling (0-1) |\n| `frequency_penalty` | `0.0` | Reduces repetition (-2 to 2) |\n| `presence_penalty` | `0.0` | Encourages new topics (-2 to 2) |\n| `system_prompt` | `\"你是一个严谨的助手\"` | System message |\n| `timeout` | `inf` | Session timeout in seconds (ChatManager only) |",
"cost": {
"context_tokens": 920
}
}
Fetch it by URL: GET /api/v1/registry/wangyendt-wayne-skills-chat-bot/manifest?version=1.0.0
Reviews
Star ratings from people who tried it. One review per account; edit yours any time.
No reviews yet. Install it, try it, and be the first to rate it.