LangChain
Python and JavaScript agent framework
LangChain makes it easy to build agents that call LLMs. With Till, you can give each agent run a scoped key with hard limits on spend or activations.
Python
from langchain_openai import ChatOpenAI # Create a Till scoped key first (via dashboard or API) # till_sk_abc123... with $5 spend limit llm = ChatOpenAI( model="gpt-4", api_key="till_sk_abc123...", # Your Till scoped key base_url="https://api.till.ac/proxy/openai/v1" ) # Use normally - Till enforces limits automatically response = llm.invoke("Hello, world!")
JavaScript/TypeScript
import { ChatOpenAI } from "@langchain/openai"; const llm = new ChatOpenAI({ model: "gpt-4", apiKey: "till_sk_abc123...", configuration: { baseURL: "https://api.till.ac/proxy/openai/v1" } }); const response = await llm.invoke("Hello, world!");
With Anthropic
from langchain_anthropic import ChatAnthropic llm = ChatAnthropic( model="claude-3-opus-20240229", api_key="till_sk_xyz789...", base_url="https://api.till.ac/proxy/anthropic" )