Created
January 20, 2026 16:20
-
-
Save doozie-akshay/0e376bed062909c66b3779e783b43e90 to your computer and use it in GitHub Desktop.
Quotio Proxy for Opencode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Using Quotio as a Local OpenAI-Compatible Proxy (macOS) | |
| > ⚠️ **Experimental use only** | |
| > This setup may violate upstream provider ToS. | |
| > Rate-limits, throttling, or account bans are your responsibility. | |
| --- | |
| ## 1. Prerequisites | |
| - macOS 12+ | |
| - Quotio app installed and running | |
| - Quotio **local proxy started** from UI | |
| - **Quotio API Key** generated (Settings → API / Developer) | |
| Typical proxy endpoint: | |
| http://127.0.0.1:8315/v1 | |
| --- | |
| ## 2. Authentication (Mandatory) | |
| When API-key mode is enabled, Quotio **requires auth**. | |
| Supported headers: | |
| - `Authorization: Bearer <QUOTIO_API_KEY>` ✅ (recommended) | |
| - `x-api-key: <QUOTIO_API_KEY>` | |
| --- | |
| ## 3. OpenAI-Compatible Provider Setup (OpenCode / AI SDK) | |
| ### `config.json` | |
| ```json | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "provider": { | |
| "quotio": { | |
| "npm": "@ai-sdk/openai-compatible", | |
| "name": "Quotio", | |
| "options": { | |
| "baseURL": "http://127.0.0.1:8315/v1", | |
| "apiKey": "QUOTIO_API_KEY" | |
| }, | |
| "models": { | |
| "qwen3-coder-plus": { | |
| "name": "Qwen3 Coder Plus" | |
| }, | |
| "glm-4.7": { | |
| "name": "GLM-4.7" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| Notes: | |
| • apiKey must be present | |
| • SDK sends it as Authorization: Bearer … | |
| • Model names must match Quotio’s internal mapping | |
| ⸻ | |
| 4. CLI / Environment Variable Setup | |
| For tools that rely on OpenAI-style env vars: | |
| export OPENAI_BASE_URL="http://127.0.0.1:8315/v1" | |
| export OPENAI_API_KEY="QUOTIO_API_KEY" | |
| Works with: | |
| • OpenCode | |
| • Claude Code (OpenAI-compat mode) | |
| • Codex-style CLIs | |
| • Any OpenAI-compatible SDK | |
| ⸻ | |
| 5. Verification (Authoritative Test) | |
| curl http://127.0.0.1:8315/v1/chat/completions \ | |
| -H "Content-Type: application/json" \ | |
| -H "Authorization: Bearer QUOTIO_API_KEY" \ | |
| -d '{ | |
| "model": "qwen3-coder-plus", | |
| "messages": [ | |
| { "role": "user", "content": "ping" } | |
| ] | |
| }' | |
| Expected: | |
| • 200 OK | |
| • JSON response | |
| • Request visible in Quotio traffic logs | |
| ⸻ | |
| 6. Routing Reality Check | |
| • API key authenticates the proxy | |
| • Provider / account selection happens inside Quotio | |
| • Client cannot force: | |
| • upstream account choice | |
| • paid vs free pools | |
| • rotation strategy | |
| These are Quotio-side policies only. | |
| ⸻ | |
| 7. Common Failure Modes | |
| Symptom Cause | |
| 401 / 403 Missing or invalid Quotio API key | |
| Works in UI, fails in SDK Authorization header not passed | |
| Random throttling Upstream provider rate limits | |
| Model not found Name mismatch vs Quotio mapping | |
| ⸻ | |
| 8. Bottom Line | |
| • Quotio acts as a secured OpenAI-compatible gateway | |
| • Client config = baseURL + apiKey | |
| • Routing, failover, quotas are controlled in Quotio | |
| • Use strictly for internal experiments | |
| ⸻ | |
| --- | |
| ## Disclaimer | |
| This document is provided **for educational and experimental purposes only**. | |
| The author does **not endorse or encourage** bypassing rate limits, violating terms of service, or misusing third-party APIs. | |
| - You are solely responsible for compliance with all applicable **provider ToS**, **licensing terms**, and **local laws**. | |
| - Use of proxies, account aggregation, or traffic routing may result in **throttling, suspension, or permanent bans** by upstream providers. | |
| - This setup is **not suitable for production**, client-facing systems, or regulated environments. | |
| - No guarantees are made regarding availability, correctness, security, or long-term viability. | |
| Proceed only if you fully understand and accept these risks. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment