Metadata-Version: 2.4
Name: fastllm-claude-code
Version: 0.0.12
Summary: Claude Code API for fastllm
Author-email: Kerem Turgutlu <keremturgutlu@gmail.com>
License: Apache-2.0
Project-URL: Repository, https://github.com/AnswerDotAI/fastllm-claude-code
Project-URL: Documentation, https://AnswerDotAI.github.io/fastllm-claude-code/
Keywords: nbdev
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-fastllm>=0.0.44
Requires-Dist: fastclaude>=0.0.3
Requires-Dist: fasttransport>=0.0.2
Dynamic: license-file

# fastllm-claude-code


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

This FastLLM provider runs models through an authenticated Claude Code CLI using [fastclaude](https://github.com/AnswerDotAI/fastclaude). Ordinary streaming and non-streaming FastLLM calls work as with any provider. Client-owned tool loops do not: continuing after a tool call requires `previous_response_id`, because the paused turn lives in a running CLI process that a regular completions-style history replay cannot recreate.

## Usage

### Installation

Install latest from the GitHub [repository](https://github.com/AnswerDotAI/fastllm-claude-code):

``` sh
$ pip install git+https://github.com/AnswerDotAI/fastllm-claude-code.git
```

or from [conda](https://anaconda.org/AnswerDotAI/fastllm-claude-code)

``` sh
$ conda install -c AnswerDotAI fastllm_claude_code
```

or from [pypi](https://pypi.org/project/fastllm-claude-code/)

``` sh
$ pip install fastllm_claude_code
```

### Documentation

Documentation can be found hosted on this GitHub [repository](https://github.com/AnswerDotAI/fastllm-claude-code)’s [pages](https://AnswerDotAI.github.io/fastllm-claude-code/). Additionally you can find package manager specific guidelines on [conda](https://anaconda.org/AnswerDotAI/fastllm-claude-code) and [pypi](https://pypi.org/project/fastllm-claude-code/) respectively.

## How to use

Installing the package registers the `claude_code` transport through FastLLM’s provider entry point. The Claude CLI must already be installed and authenticated for the current user.

A normal FastLLM call uses the provider prefix:

``` python
from fastllm.acomplete import acomplete

answer = await acomplete('Answer briefly: what is 2+2?', model='claude_code/claude-sonnet-5')
```

For a client-owned tool loop, pass standard Responses API or Chat Completions function schemas. Continuing after a tool call requires `previous_response_id`: it is not a regular completions turn, since replaying history cannot resume the paused process. The parameter is FastLLM’s standard continuation contract, shared with the Responses transport, but here the id names a paused local process rather than stored server state. A response containing tool calls has a `response_id` naming that process:

``` python
first = await acomplete(messages, model='claude_code/claude-sonnet-5', tools=tools)
assert first.tool_calls and first.response_id
assert not first.response_id_reusable

final = await acomplete(tool_result_messages, model='claude_code/claude-sonnet-5',
    tools=tools, previous_response_id=first.response_id)
assert final.response_id is None
```

The continuation ID is opaque, one-shot, and process-local. It expires after `response_ttl` seconds (3600 by default), and `claude_cancel(response_id)` closes an abandoned paused process. Reusing an expired or consumed ID raises a 409 `invalid_previous_response_id` error. A terminal response deliberately has no ID; a later top-level turn should replay canonical history into a fresh Claude process.

Set `stream=True` for FastLLM’s normalized async stream. Non-streaming calls collect the same stream into one `Completion`. The adapter returns tool requests but never executes them.
