Skip to content

Allow custom LLM providers without modifying Graphify source code #1084

Closed

Description

@timburman

Problem

Currently, adding a new LLM provider requires modifying Graphify source code (llm.py) and adding a new provider entry.

For example, I was able to use NVIDIA's OpenAI-compatible endpoint successfully by adding a provider configuration locally, but this required editing Graphify internals. Users without the ability or confidence to patch the source are effectively limited to the built-in providers.

Since Graphify already treats providers as metadata (base URL, model name, env key, temperature, pricing, etc.), adding support for new OpenAI-compatible providers should not require a code change.

Proposed Solution

Allow users to register custom providers through the CLI.

Example:

graphify provider add nvidia \
  --base-url https://integrate.api.nvidia.com/v1 \
  --default-model minimaxai/minimax-m2.7 \
  --env-key NVIDIA_API_KEY

Then use it normally:

graphify . --backend nvidia

Possible additional commands:

graphify provider list
graphify provider show nvidia
graphify provider remove nvidia

Providers could be stored in a user configuration file (for example ~/.graphify/providers.json) and merged with the built-in provider registry at runtime.

Benefits

  • No source-code modifications required.
  • Enables NVIDIA NIM and other OpenAI-compatible endpoints.
  • Supports self-hosted vLLM deployments.
  • Supports OpenRouter, Together AI, DeepInfra, Fireworks, LiteLLM gateways, and future providers.
  • Reduces maintenance burden since new providers do not require upstream changes.
  • Keeps existing built-in providers unchanged.

Additional context:

I tested this locally by adding a provider entry in llm.py:

"nvidia": {
    "base_url": "https://integrate.api.nvidia.com/v1",
    "default_model": "minimaxai/minimax-m2.7",
    "env_key": "OPENAI_API_KEY",
    "model_env_key": "GRAPHIFY_OPENAI_MODEL",
    "pricing": {"input": 0.0, "output": 0.0},
    "temperature": 0,
},

After adding the provider entry, Graphify was able to generate graphs using the NVIDIA endpoint without requiring changes elsewhere in the request flow.

This suggests the current architecture is already largely provider-agnostic and that a user-configurable provider registry could be implemented with relatively small changes.

Activity

  1. safishamsi commented on May 30, 2026

    @safishamsi
    Member

    Landed in commit a9d6be6.

    Your analysis was right — the architecture was already there. Three changes:

    1. Provider registry loaded at import — ~/.graphify/providers.json (global) and .graphify/providers.json (per-project) are merged into BACKENDS at module import time. Built-in provider names are protected and cannot be overridden. Missing pricing defaults to zero so estimate_cost never blows up.

    2. CLI commands:

    graphify provider add nvidia \
      --base-url https://integrate.api.nvidia.com/v1 \
      --default-model minimaxai/minimax-m2.7 \
      --env-key NVIDIA_API_KEY
    
    graphify provider list
    graphify provider show nvidia
    graphify provider remove nvidia

    3. detect_backend() updated — custom providers are tried after all built-ins (gemini → kimi → claude → openai → deepseek → bedrock → ollama → custom), so they never shadow a configured paid key silently.

    Caveat noted in the issue holds: only OpenAI-compatible endpoints work this way (claude/bedrock have bespoke transports). NVIDIA NIM, vLLM, OpenRouter, Together, LiteLLM etc. all work fine.

  2. added a commit that references this issue on May 30, 2026
    a9d6be6
  3. added a commit that references this issue on Aug 13, 2026
    740c7fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions