Skip to content

Python quickstart examples #13

@smigolsmigol

Description

@smigolsmigol

Write Python quickstart examples showing how to use LLMKit.

Primary: Python SDK (NEW)

We now have a Python SDK: pip install llmkit

Examples to write using the SDK:

  1. Basic chat completion (from llmkit import LLMKit)
  2. Streaming response (client.chat_stream() with CostStream)
  3. Session tracking (client.session("my-agent"))
  4. Cost callback (on_cost= parameter)
  5. Standalone cost estimation (estimate_cost(response) - works without proxy)
  6. Async client (AsyncLLMKit)

Secondary: base_url approach (zero-migration)

For devs who don't want to change their existing code:
7. OpenAI client with base_url pointed at proxy
8. With session tracking header (x-llmkit-session-id)

Framework integrations

  1. LangChain with LLMKit SDK
  2. LlamaIndex with LLMKit SDK

Each example should be a standalone .py file in examples/ directory. Include requirements.txt.

Proxy URL: https://llmkit-proxy.smigolsmigol.workers.dev/v1
Auth: LLMKIT_API_KEY env var or api_key= parameter

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions