{"id":33320410,"url":"https://github.com/aryaminus/dspy-proxy","last_synced_at":"2026-05-12T12:02:43.596Z","repository":{"id":324994581,"uuid":"1099408993","full_name":"aryaminus/dspy-proxy","owner":"aryaminus","description":"A REST API server for DSPy that enables language model programming from any language. This proxy exposes DSPy's core functionality - signature registration, module execution, optimization, and evaluation - through HTTP endpoints, making it accessible from non-Python environments.","archived":false,"fork":false,"pushed_at":"2025-11-19T01:12:40.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-19T02:27:45.059Z","etag":null,"topics":["ai","chain-of-thought","dspy","fastapi","llm-optimization","machine-learning","microservice","nlp","prompt-engineering","proxy-server","rest-api"],"latest_commit_sha":null,"homepage":"https://dspy-proxy.onrender.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aryaminus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-19T00:39:19.000Z","updated_at":"2025-11-19T01:12:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aryaminus/dspy-proxy","commit_stats":null,"previous_names":["aryaminus/dspy-proxy"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aryaminus/dspy-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryaminus%2Fdspy-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryaminus%2Fdspy-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryaminus%2Fdspy-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryaminus%2Fdspy-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aryaminus","download_url":"https://codeload.github.com/aryaminus/dspy-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryaminus%2Fdspy-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285348528,"owners_count":27156475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-19T02:00:05.673Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chain-of-thought","dspy","fastapi","llm-optimization","machine-learning","microservice","nlp","prompt-engineering","proxy-server","rest-api"],"created_at":"2025-11-20T00:00:17.309Z","updated_at":"2025-11-20T00:00:18.385Z","avatar_url":"https://github.com/aryaminus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DSPy Proxy Server\n\nA proxy server for [DSPy](https://github.com/stanfordnlp/dspy) that allows you to register signatures, execute modules, and run optimization procedures via a REST API. This enables using DSPy from languages other than Python. Idea seed from [tweet](https://x.com/skylar_b_payne/status/1990808733140779488)!\n\n[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/aryaminus/dspy-proxy)\n\n## Features\n\n- **Register Signatures**: Define input/output signatures dynamically.\n- **Execute Modules**: Run `Predict`, `ChainOfThought`, or `ProgramOfThought` modules.\n- **Optimize**: Compile modules using `BootstrapFewShot`, `MIPROv2`, or `COPRO`.\n- **Evaluate**: Run evaluation on your modules using `dspy.Evaluate`.\n- **Configure LM**: Set up the Language Model (OpenAI supported).\n\n## Installation\n\n1. Clone the repository.\n2. Create a virtual environment and install dependencies:\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate\n   pip install -r requirements.txt\n   ```\n\n## Usage\n\nStart the server:\n```bash\npython main.py\n```\n\nThe server runs on `http://0.0.0.0:8000`.\n\n## Deployment\n\n### Option 1: One-Click Deploy\n\n[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/aryaminus/dspy-proxy)\n\n### Option 2: Manual Deployment\n\nThis project is configured for deployment on [Render](https://render.com).\n\n1.  Fork this repository.\n2.  Create a new **Web Service** on Render.\n3.  Connect your repository.\n4.  Render will automatically detect the `render.yaml` configuration.\n5.  Add your `OPENAI_API_KEY` in the Environment Variables settings on Render.\n\n## API Endpoints\n\n### 1. Configure LM\n`POST /configure`\n```json\n{\n  \"provider\": \"openai\",\n  \"model\": \"gpt-4o-mini\",\n  \"api_key\": \"sk-...\"\n}\n```\nSupported providers: `openai`, `anthropic`, `google`, `azure`, etc. (any provider supported by `litellm`).\nIf `api_key` is omitted, the server will look for environment variables like `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.\n\n### 2. Register Signature\n`POST /register`\n```json\n{\n  \"name\": \"qa\",\n  \"signature\": \"question -\u003e answer\",\n  \"instructions\": \"Answer the question concisely.\"\n}\n```\n\n### 3. Predict\n`POST /predict`\n```json\n{\n  \"signature_name\": \"qa\",\n  \"inputs\": {\n    \"question\": \"What is the capital of France?\"\n  },\n  \"module_type\": \"ChainOfThought\"\n}\n```\nSupported `module_type`: `Predict`, `ChainOfThought`, `ProgramOfThought`.\n\n### 4. Optimize\n`POST /optimize`\n```json\n{\n  \"signature_name\": \"qa\",\n  \"train_data\": [\n    {\"question\": \"What is 1+1?\", \"answer\": \"2\"},\n    {\"question\": \"What is 2+2?\", \"answer\": \"4\"}\n  ],\n  \"metric\": \"exact_match\",\n  \"optimizer\": \"BootstrapFewShot\",\n  \"max_bootstraps\": 4\n}\n```\nSupported `optimizer`: `BootstrapFewShot`, `MIPROv2`, `COPRO`.\nReturns a `module_id`.\n\n### 5. Predict with Optimized Module\n`POST /predict`\n```json\n{\n  \"signature_name\": \"qa\",\n  \"inputs\": {\n    \"question\": \"What is 3+3?\"\n  },\n  \"compiled_module_id\": \"qa_opt_0\"\n}\n```\n\n### 6. Evaluate\n`POST /evaluate`\n```json\n{\n  \"signature_name\": \"qa\",\n  \"test_data\": [\n    {\"question\": \"What is 5+5?\", \"answer\": \"10\"}\n  ],\n  \"metric\": \"exact_match\",\n  \"compiled_module_id\": \"qa_opt_0\"\n}\n```\nReturns a `score`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryaminus%2Fdspy-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faryaminus%2Fdspy-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryaminus%2Fdspy-proxy/lists"}