Skip to content

feat: Add OpenCode API provider support #296

Description

@tothKarolyDavid

Problem / Motivation

Currently, the hiring-agent supports Ollama (local) and Gemini (Google API). There is no native support for OpenAI-compatible hosted API providers (specifically OpenCode, https://opencode.ai), which allows developers to run high-quality open-weight models like deepseek-v4-flash via API without needing local GPU hardware.

Expected behavior

Users should be able to configure their environment to use OpenCode:

  • Set LLM_PROVIDER=opencode
  • Configure OPENCODE_API_KEY
  • Set DEFAULT_MODEL=deepseek-v4-flash to parse and score resumes.

Proposed solution

Add an OpenCodeProvider implementation and integrate it:

  1. Add OPENCODE = "opencode" to the ModelProvider enum in models.py.
  2. Implement the OpenCodeProvider class (supporting OpenAI-compatible chat completions structure) in models.py.
  3. Update initialize_llm_provider in llm_utils.py to support initializing this new provider.
  4. Support model parameters and map deepseek-v4-flash to the OpenCode provider in prompt.py.
  5. Update .env.example to document the new provider and model options.
  6. Add unit tests for the provider class and initialization logic in tests.py using standard unittest.

Alternatives considered

  • Run Ollama locally: Forces users to run models locally, which is slow or impossible on devices without dedicated/powerful GPUs.
  • Use Gemini: Restricts the API pipeline to Google's models.

Additional context

I have already implemented this locally, formatted all files with Black, and verified that the unit tests pass successfully. The changes are ready for a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions