Skip to content

Transparency: undocumented LLM providers + kimi default in extract_files_direct() #1086

Closed

Description

@EmanuelFaria

Summary

Two related transparency/disclosure concerns discovered while reviewing v0.8.25:


1. extract_files_direct() defaults to kimi (Moonshot AI) in the Python API

In llm.py, the public function signature is:

def extract_files_direct(
    files: list[Path],
    backend: str = "kimi",   # ← defaults to Moonshot AI (Chinese provider)
    ...
)

If a user calls this function directly — or integrates graphify as a library — their source code is sent to api.moonshot.ai/v1 without any explicit consent or warning.

The CLI (graphify extract) handles this better: it picks "whichever API key is set." But that logic is in __main__.py, not in the underlying API. Users who import graphify programmatically hit the kimi default.

Why this matters: Moonshot AI (Kimi) is a Chinese AI company. Users with data residency requirements, enterprise policies, or open-source IP to protect may not be aware their code is leaving their jurisdiction.


2. README doesn't mention LLM providers or external API calls at all

The README describes graphify as a knowledge graph builder but does not mention:

  • That semantic extraction sends source code to external LLM APIs
  • Which providers are supported (Anthropic, Gemini, OpenAI, DeepSeek, Kimi, Ollama)
  • What data is sent (file contents? full AST dumps?)
  • How to run in a fully local/offline mode (Ollama)

This is a significant omission for a tool that reads private codebases.


Suggested fixes

  1. Change the extract_files_direct() default from "kimi" to None or "anthropic" — require explicit opt-in for third-party providers, especially non-Western ones
  2. Add a providers section to the README listing all supported backends, what data they receive, and how to use Ollama for fully local extraction
  3. Emit a warning when a backend other than the one implied by the user's active API key is selected

My setup (for context)

  • MOONSHOT_API_KEY is NOT set in my environment — so no data went to moonshot.ai
  • The CLI correctly picked Claude (Anthropic) since ANTHROPIC_API_KEY is set
  • The PostToolUse hooks I have only check if graph.json exists — they don't call LLM extraction

This is a disclosure request, not a bug report. The code works correctly — but users deserve to know what it connects to.

Activity

  1. safishamsi commented on May 30, 2026

    @safishamsi
    Member

    Both points addressed in commit 006e159.

    1. extract_files_direct() default changed — signature is now backend: str | None = None. When unset it calls detect_backend(), which picks whichever API key you have set (same priority order as the CLI: Gemini → Kimi → Claude → OpenAI → DeepSeek → Bedrock → Ollama). If nothing is configured, it raises a clear ValueError listing every env var option rather than silently routing to kimi. Explicit backend= arguments still work identically — backward-compatible change.

    2. README Privacy section updated — added a Data residency bullet that explains the auto-detect priority order, points at --backend ollama for fully local runs, and explicitly names Kimi as a Chinese provider routing to Moonshot AI servers.

    Good catch — the CLI and library were inconsistent and this closes the gap. Note: even before this fix, calling extract_files_direct() without MOONSHOT_API_KEY set would raise a ValueError before any network call (the key check at llm.py:662), so no data was actually leaving the machine. But the implicit default was still wrong design and worth fixing on principle.

  2. added a commit that references this issue on May 30, 2026
    006e159
  3. added a commit that references this issue on Aug 13, 2026
    a20b779
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