copaw-openai-compat
OpenAI compatible provider templates for CoPaw.
This package allows dynamic injection of OpenAI-compatible providers into a running CoPaw instance without modifying the core code.
Features
- Zero Code Modification: Inject providers via HTTP API
- Multiple Templates: Pre-configured templates for popular services
- Custom Providers: Create your own providers with custom endpoints
- Web Console Integration: Configured providers appear in CoPaw's Web UI
- Auto-detection: Automatically reads CoPaw's port from
~/.copaw/config.json
Installation
pip install copaw-openai-compat
Or install from source:
cd copaw-openai-compat
pip install -e .
Quick Start
1. Make sure CoPaw is running
# Start CoPaw API server
copaw app
# Or start as daemon
copaw daemon start
2. List available templates
copaw-provider list
3. Install a provider
# Install Groq
copaw-provider install groq
# Install with API key
copaw-provider install groq --api-key gsk_xxx
# Install all templates
copaw-provider install --all
4. Configure in Web Console
Open http://localhost:8088 in your browser, navigate to Settings > Models, and configure the newly installed provider.
Port Configuration
The plugin automatically reads CoPaw's port from ~/.copaw/config.json. If you're using a different port:
# Specify custom port
copaw-provider --base-url http://127.0.0.1:YOUR_PORT install groq
# Or set environment variable
export COPAW_BASE_URL=http://127.0.0.1:YOUR_PORT
copaw-provider install groq
Available Templates
| Template ID | Name | Base URL | Description |
|---|---|---|---|
openai-compatible |
OpenAI Compatible | (user input) | Generic template for any OpenAI-compatible API |
groq |
Groq | api.groq.com |
Ultra-fast inference platform |
together |
Together AI | api.together.xyz |
Open-source model cloud |
openrouter |
OpenRouter | openrouter.ai |
Unified API for 200+ LLMs |
moonshot |
Moonshot AI | api.moonshot.cn |
Kimi intelligent assistant |
zhipu |
Zhipu AI | open.bigmodel.cn |
GLM series models |
deepseek-api |
DeepSeek API | api.deepseek.com |
Advanced reasoning model |
siliconflow |
SiliconFlow | api.siliconflow.cn |
Cost-effective inference platform |
CLI Commands
copaw-provider list
List all available provider templates.
copaw-provider list
copaw-provider install <template_id>
Install a provider template.
# Basic installation
copaw-provider install groq
# With API key
copaw-provider install groq --api-key gsk_xxx
# Override base URL
copaw-provider install openai-compatible --base-url https://api.custom.com/v1
# Install all templates
copaw-provider install --all
copaw-provider create <id>
Create a custom provider (not from template).
copaw-provider create my-provider \
--name "My Provider" \
--base-url "https://api.example.com/v1" \
--api-key "sk-xxx" \
--api-key-prefix "sk-"
copaw-provider uninstall <provider_id>
Uninstall a provider.
copaw-provider uninstall groq
copaw-provider uninstall my-provider -y # Skip confirmation
copaw-provider installed
List installed custom providers.
copaw-provider installed
copaw-provider check
Check connection to CoPaw server and show current configuration.
copaw-provider check
copaw-provider config
Show current configuration details.
copaw-provider config
Environment Variables
| Variable | Description | Default |
|---|---|---|
COPAW_BASE_URL |
CoPaw server URL | Auto-detected from ~/.copaw/config.json |
Adding Custom Templates
Templates are YAML files in the templates/ directory:
# templates/my-provider.yaml
id: my-provider
name: My Provider
description: Custom provider description
default_base_url: https://api.example.com/v1
api_key_prefix: sk-
chat_model: OpenAIChatModel
support_model_discovery: true
require_api_key: true
freeze_url: true
default_models:
- id: model-1
name: Model 1
- id: model-2
name: Model 2
How It Works
- HTTP API: Uses CoPaw's existing
/api/models/custom-providersendpoint - Dynamic Injection: No modification to CoPaw's source code
- Persistent Storage: Providers are saved in
~/.copaw.secret/providers/custom/ - Web UI Integration: Installed providers appear automatically in the Web Console
Troubleshooting
"Cannot connect to CoPaw"
Make sure CoPaw is running:
copaw app
# or
copaw daemon start
Wrong port
Check your CoPaw port:
copaw-provider config
Or specify manually:
copaw-provider --base-url http://127.0.0.1:YOUR_PORT install groq
License
MIT
Disclaimer
This is an independent, community-developed plugin for CoPaw. It is not affiliated with, endorsed by, or sponsored by the CoPaw project.
Metadata
Release files for copaw-openai-compat 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| copaw_openai_compat-0.1.1.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| copaw_openai_compat-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.8 kB
Release files / copaw_openai_compat-0.1.1.tar.gz
| Download URL | copaw_openai_compat-0.1.1.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9ad8ecea3d7b71ba0f0f003c4fd875a9b41ed0223699c2baafee38abdecea15
|
|
BLAKE2b-256 checksum How to use checksums |
412414b57f3ca3c9e0ed478b534a47adfadff6eb267d203d8d367ff2ef8e892a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / copaw_openai_compat-0.1.1-py3-none-any.whl
| Download URL | copaw_openai_compat-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84a2cece5cbf168ceef378e47dd92f2a37968ea8157d4d73cc1061ff7fa915f5
|
|
BLAKE2b-256 checksum How to use checksums |
8380000b9858bcb4b09db42f1b1872179180bd98626754f9faa9b02006449f61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|