Hack: claude -p A developer shares a quick hack using the `claude -p` command-line tool to call Anthropic's Claude API without separate key management, leveraging the existing authenticated Claude environment. The script, which classifies GitHub pull requests, uses a subprocess call to `claude -p` with a prompt and returns JSON output, simplifying LLM integration in work contexts. Hack: claude -p claude -p is a quick hack that I find myself using more. Calling one of the various LLM APIs is easy. But requires key management. For me on a personal project that’s no big deal. In a work context it’s less trivial. But I’m working in claude , which means I have a tool talking to a LLM API running already all the time, that already has not only an API key, but also an allocated budget that is being managed around making me more productive. Much easier if all my LLM based productivity is spend hits a single line item. E.g. a quick script to classify Github PRs has a section like: return f"""You are classifying GitHub pull requests for an engineering team. PRODUCT AREAS choose exactly one per PR : {area lines} WORK TYPES choose exactly one per PR : {work type lines} For each PR, return a JSON array with these fields: - pr id, product area, work type, confidence, keywords Return ONLY the JSON array. No prose, no markdown fences. PULL REQUESTS: {prs text}""" And the call itself: php def call claude prompt: str - str | None: try: result = subprocess.run 'claude', '-p', '--output-format', 'text' , input=prompt, capture output=True, text=True, timeout=300, return result.stdout.strip if result.returncode == 0 else None except subprocess.TimeoutExpired, FileNotFoundError : return None Probably this is what the agent sdk is for? This worked.