Frameworks
Use TokenBazaar with LangChain
Use TokenBazaar as a custom OpenAI-compatible provider in LangChain.
Before you start
- A TokenBazaar API key
- A version of the app that accepts a custom OpenAI-compatible base URL
Step-by-step setup
- 1
Install langchain-openai in your Python project.
- 2
Create ChatOpenAI with the TokenBazaar base URL, key and model ID shown below.
- 3
Call invoke or use the model inside your chain or agent.
Configuration
python
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://tokenbazaar.in/api/public/v1",
api_key="tb_sk_...",
model="openai/gpt-6-astra",
)
print(llm.invoke("Explain this repository in five bullets.").content)Verify the connection
Start a short chat, then confirm the request appears in your TokenBazaar Dashboard with the model ID you selected.