Skip to content

OpenAI-compatible endpoints & Ollama

The openai provider talks to any server that implements the OpenAI Chat Completions API (POST /chat/completions). That covers OpenAI itself plus self-hosted and gateway options.

Variable Flag Notes
AI_PROVIDER=openai -a openai
OPENAI_BASE_URL or AI_API_URL -u Default https://api.openai.com/v1
OPENAI_API_KEY -k Optional; omitted for servers that don't need auth
OPENAI_MODEL or AI_MODEL -c Required

Examples

ai-code-review:
  image: node:20
  variables:
    AI_PROVIDER: openai
    OPENAI_BASE_URL: http://ollama.internal:11434/v1
    AI_MODEL: qwen2.5-coder:14b
  script:
    - npx -y @parvez3019/ai-code-review-gitlab-plugin
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"

No code ever leaves your network. The runner just needs to reach the Ollama host.

variables:
  AI_PROVIDER: openai
  AI_MODEL: <model id>
  # OPENAI_API_KEY set as a masked CI/CD variable
variables:
  AI_PROVIDER: openai
  OPENAI_BASE_URL: https://your-gateway.example.com/v1
  AI_MODEL: <model id as exposed by the gateway>

Tip

Smaller local models follow the "reply 204 when there is nothing significant" instruction less reliably. If you get noisy reviews, try a larger model or tighten the prompt.