Skip to main content

OpenAI compatible provider templates for CoPaw - dynamic injection without modifying core code

Project description

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

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

copaw serve

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:8000 in your browser, navigate to Settings > Models, and configure the newly installed provider.

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.

copaw-provider check

Environment Variables

Variable Description Default
COPAW_BASE_URL CoPaw server URL http://127.0.0.1:8000

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

  1. HTTP API: Uses CoPaw's existing /api/models/custom-providers endpoint
  2. Dynamic Injection: No modification to CoPaw's source code
  3. Persistent Storage: Providers are saved in ~/.copaw.secret/providers/custom/
  4. Web UI Integration: Installed providers appear automatically in the Web Console

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copaw_openai_compat-0.1.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

copaw_openai_compat-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file copaw_openai_compat-0.1.0.tar.gz.

File metadata

  • Download URL: copaw_openai_compat-0.1.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for copaw_openai_compat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 60a3ec8a882aaa3c16c3e442aab9edd9a2eb54a0ad8a858a5700c8626afa4cc2
MD5 f9129dce90d35b824e4d6cb3daf2b5eb
BLAKE2b-256 d4549a824f9434073542889ea8f7f0b4097a5ed82fc19dfa2514bfd3d316f950

See more details on using hashes here.

File details

Details for the file copaw_openai_compat-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for copaw_openai_compat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13678046cb3c0696e7518b61e8b03ba3be944a4f104369844625f7538b01bc01
MD5 51658cd622553990a9764c46147b5712
BLAKE2b-256 e853e72dfcdaaef928373a7f30364d338b7d17b954d4f8c7a5ffe8a12e125fa1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page