Skip to content

Add OpenAI adapter #2

@simonhsze

Description

@simonhsze

What

Add an OpenAI-compatible adapter (adapters/openai.py) that implements the LLMAdapter interface.

Why

Many users have OpenAI API keys. This is the most requested missing adapter.

How

  1. Copy adapters/anthropic_api.py as a starting template
  2. Implement call() using the openai Python SDK
  3. Map ChatCompletion response to LLMResponse
  4. Add lazy import in adapters/__init__.py (same pattern as other adapters)
  5. Add tests using MockAdapter patterns (no real API calls)
  6. Add openai to optional dependencies in pyproject.toml

Reference

  • adapters/base.py — the interface to implement
  • adapters/anthropic_api.py — closest reference implementation
  • tests/test_adapters.py — test patterns

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions