Skip to content

refactor: AiGateway with adapter pattern (LLM + Codex)#42

Merged
Pigbibi merged 1 commit into
mainfrom
feat/ai-gateway-adapters
Jun 29, 2026
Merged

refactor: AiGateway with adapter pattern (LLM + Codex)#42
Pigbibi merged 1 commit into
mainfrom
feat/ai-gateway-adapters

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends the existing CodexAuditBridge service into a general-purpose AI Gateway.

Architecture

                    AiGateway
                        │
            ┌───────────┼───────────┐
            ▼           ▼           ▼
    LlmAdapter   CodexAdapter   FutureAdapter
    (API call)   (codex exec)   (your backend)

Changes

  • AiAdapter (ABC): base protocol for all AI backends — just implement run()
  • LlmAdapter: direct Anthropic/OpenAI API calls (sync response, no repo)
  • CodexAdapter: existing codex exec logic (async job, needs repo clone)
  • Adapter Registry: _ADAPTER_REGISTRY dict — adding a new backend = one new class
  • API keys moved from GitHub repos to VPS env vars

API

  • task: "analyze" → LlmAdapter (sync, returns inline)
  • task: "execute" → CodexAdapter (async, returns job_id)

Benefits

  • API keys in one place (VPS), not duplicated across N repos
  • QuantStrategyLifecycle now needs only CODEX_AUDIT_SERVICE_URL
  • Adding a new AI backend = new adapter class, no service plumbing changes

Co-Authored-By: Claude noreply@anthropic.com

Extends the existing CodexAuditBridge service into a general-purpose AI Gateway
using the strategy/adapter pattern:

- AiAdapter (ABC): base protocol for all AI backends
- LlmAdapter: direct API calls (Claude/GPT), sync response
- CodexAdapter: codex exec execution, async job
- _ADAPTER_REGISTRY: extensible — add backend = new adapter class

New payload fields:
  - task: 'analyze' (LLM, sync) | 'execute' (Codex, async)
  - model: backend model selection (per-request)

API keys moved from GitHub repos to VPS env vars.
Clients need only CODEX_AUDIT_SERVICE_URL.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🤖 Codex PR Review

⚠️ Review skipped: The Codex review could not be completed.

Codex service request failed: 401 {"status": "error", "error": "OIDC workflow_ref is not allowed"}

Please ensure a human reviewer checks this PR before merging.

@Pigbibi Pigbibi merged commit ef69388 into main Jun 29, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant