feat: add ClaudeCodeClient — LLM inference via Claude Code SDK (no API key) - #1766
Open
openbiocure wants to merge 2 commits into
Open
feat: add ClaudeCodeClient — LLM inference via Claude Code SDK (no API key)#1766openbiocure wants to merge 2 commits into
openbiocure wants to merge 2 commits into
Conversation
Uses the Claude Agent SDK subprocess for inference. No API key needed —
authenticates via Claude Code's OAuth credentials (~/.claude).
Key features:
- Persistent subprocess: first call ~8s (startup), subsequent calls ~3s
- Context monitoring: auto-recycles subprocess when context exceeds threshold
- Stateless extraction: each query is independent via the persistent client
- JSON extraction: parses structured output from text responses
- Thread-safe: async lock prevents concurrent subprocess access
Usage:
from graphiti_core.llm_client.claude_code_client import ClaudeCodeClient
from graphiti_core.llm_client.config import LLMConfig
client = ClaudeCodeClient(config=LLMConfig(model='haiku'))
graphiti = Graphiti(graph_driver=driver, llm_client=client, ...)
Tested end-to-end with FalkorDB + HuggingFace embeddings.
Episode ingestion: ~13s (including subprocess startup).
Search returns extracted entities and relationships correctly.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
openbiocure
force-pushed
the
feat/claude-code-sdk-client
branch
2 times, most recently
from
August 13, 2026 20:33
70343f3 to
cde6870
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: openbiocure@gmail.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
ClaudeCodeClientLLM provider that uses the Claude Agent SDK for inference. Authenticates via Claude Code's OAuth credentials (~/.claude) — no API key required.Motivation
Users of Claude Code (CLI, desktop, IDE extensions) already have authenticated sessions. This client lets Graphiti piggyback on that auth instead of requiring a separate Anthropic API key. Useful for developers who want to use Graphiti locally without managing API keys.
How it works
ClaudeSDKClientget_context_usage()— auto-recycles subprocess when context exceeds threshold (default 60%)GroqClient)Usage
Testing
Tested end-to-end with FalkorDB + HuggingFace sentence-transformers embeddings:
Notes
claude-agent-sdk(optional dependency, lazy import)ClaudeCodeClientisNonewhen SDK not installedGroqClient— implements_generate_response, lets base class handle schema injection