## graphify This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships. When the user types `/graphify`, invoke the `skill` tool with `skill: "graphify"` before doing anything else. Rules: - For codebase questions, first run `graphify query ""` when graphify-out/graph.json exists. Use `graphify path "" ""` for relationships and `graphify explain ""` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output. - Dirty graphify-out/ files are expected after hooks or incremental updates; dirty graph files are not a reason to skip graphify. Only skip graphify if the task is about stale or incorrect graph output, or the user explicitly says not to use it. - If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing. - Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context. - After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost). ## OpenAI API Proxy FastAPI proxy that routes OpenAI-compatible chat requests to NVIDIA NIM based on the `sk-nvidia` key the client uses. ### Setup & run - Install: `pip install -r requirements.txt` - Copy `.env.example` to `.env` and fill in real provider API keys + proxy keys - Run: `python main.py` (uvicorn, http://127.0.0.1:8000) - Client calls `POST /v1/chat/completions` with `Authorization: Bearer sk-{provider}-...` ### Architecture - `config.py` — loads `.env`, exposes `PROVIDER_KEYS` (proxy→real key mapping) and `REAL_KEYS` - `proxy/providers.py` — `Provider` dataclass registry; adds `env_real_key` field name, `auth_header`, `handles_202` flag - `proxy/auth.py` — `resolve_provider()` matches Bearer token against `PROVIDER_KEYS`; `get_real_key()` reads the real API key from env - `proxy/client.py` — `forward_request()` streams or polls upstream; NVIDIA returns HTTP 202 then polls `/v1/status/{id}` - `proxy/router.py` — FastAPI router with `/v1/models`, `/v1/chat/completions`, `/v1/health`, `/v1/keys`; `create_app()` factory mounts static files ### Provider quirks - **NVIDIA**: Bearer token auth, async (202→poll), base URL `https://integrate.api.nvidia.com` ### Adding a new provider 1. Add `Provider(...)` to `proxy/providers.py:PROVIDERS` dict 2. Add `REAL_*_KEY` and `SK_*_KEY` env vars in `config.py` and `.env.example` 3. Add model list to `MODELS` dict in `proxy/router.py` ### Constraints - No tests, no CI, no linter/formatter config — not yet set up - No database — pure HTTP proxy - Timeouts: connect=10s, read=180s; NVIDIA poll interval=2s, max 60 attempts