BazaarLinkBazaarLink
Sign in
DocsAPI ReferenceSDK ReferenceAgentic UsageAI Skills

Agentic Usage

Agent Frameworks

Use BazaarLink with popular agent frameworks. Since BazaarLink is OpenAI-compatible, most frameworks work out of the box — just set the base URL and API key.

Vercel AI SDK

typescript
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const bazaarlink = createOpenAI({
  baseURL: "https://bazaarlink.ai/api/v1",
  apiKey: "sk-bl-YOUR_API_KEY",
});

const { text } = await generateText({
  model: bazaarlink("openai/gpt-4.1"),
  prompt: "Write a haiku about programming",
});

console.log(text);

CrewAI

python
from crewai import Agent, Task, Crew
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://bazaarlink.ai/api/v1",
    api_key="sk-bl-YOUR_API_KEY",
    model="anthropic/claude-sonnet-4.6",
)

researcher = Agent(
    role="Researcher",
    goal="Research and summarize topics",
    llm=llm,
)

task = Task(
    description="Research the latest trends in AI agents",
    agent=researcher,
)

crew = Crew(agents=[researcher], tasks=[task])
result = crew.kickoff()
print(result)

AutoGen

python
from autogen import AssistantAgent, UserProxyAgent

config_list = [{
    "model": "openai/gpt-4.1",
    "base_url": "https://bazaarlink.ai/api/v1",
    "api_key": "sk-bl-YOUR_API_KEY",
}]

assistant = AssistantAgent(
    "assistant",
    llm_config={"config_list": config_list},
)

user_proxy = UserProxyAgent(
    "user_proxy",
    human_input_mode="NEVER",
    code_execution_config={"work_dir": "coding"},
)

user_proxy.initiate_chat(
    assistant,
    message="Write a Python function to calculate fibonacci numbers",
)

Environment Variables

Most agent frameworks support configuration via environment variables:

bash
# .env
OPENAI_API_KEY=sk-bl-YOUR_API_KEY
OPENAI_BASE_URL=https://bazaarlink.ai/api/v1
Environment Variables
Any framework that supports the OpenAI API or custom base URLs can work with BazaarLink. Just set the base URL and use a BazaarLink API key.

AI Agent Auto-Registration

BazaarLink's auto-registration endpoint lets AI agents self-register and obtain an API key in a single API call. The agent also generates a "claim link" for its human owner — the owner logs in, claims the key, and it transfers to their account.

Flow

STEP 1
Bot Self-Registration
Call POST /api/v1/agents/register to receive api_key and upgrade_url
STEP 2
Bot Shares Link
Pass upgrade_url to the human owner (via chat message or notification)
STEP 3
Owner Claims
Log in, go to /keys, paste the link or token, and click "Claim"
STEP 4
Key Transfer
API key is bound to the owner's account; usable after topping up credits

Bot Self-Registration API

POST/api/v1/agents/register
bash
curl -X POST https://bazaarlink.ai/api/v1/agents/register \
  -H "Content-Type: application/json" \
  -d '{"name": "MyBot"}'
json
{
  "api_key": "sk-bl-xxxxxxxxxxxxxxxx",
  "credits": 0,
  "claim_token": "xxxxxxxx",
  "claim_expires": "2026-03-09T00:00:00.000Z",
  "upgrade_url": "https://bazaarlink.ai/claim?token=xxxxxxxx",
  "referral_code": "abc12345",
  "base_url": "https://bazaarlink.ai/api/v1",
  "docs": "https://bazaarlink.ai/llms.txt",
  "message": "I registered an account on bazaarlink.ai..."
}

Request Parameters

namerequired
string
Bot name (max 100 characters)
referral_code
string
Referral code from another bot (optional)

Usage Notes

  • The API key has no trial credits after registration; the owner must claim it and top up manually
  • claim_token is valid for 7 days; the link expires after that
  • Each IP is limited to 1 registration per 24 hours
  • After the owner claims, the key is automatically renamed to "BotName (claimed)"
  • Referral codes allow both parties to earn bonus credits during future promotional periods
Native LLM Support
BazaarLink provides documentation in llms.txt format so AI agents can read the API reference directly. Visit https://bazaarlink.ai/llms.txt for the full machine-readable API documentation.

Observability & Tracing

Connect observability tools to gain full visibility into your AI API calls, latency, and token usage.

Beta
Native observability integrations are currently in Beta. You can connect any of these tools today via the OpenAI-compatible interface.

Helicone

python
import openai

client = openai.OpenAI(
    base_url="https://gateway.helicone.ai/api/v1",
    api_key="sk-bl-YOUR_API_KEY",
    default_headers={
        "Helicone-Auth": "Bearer hc-YOUR_HELICONE_KEY",
        "Helicone-Target-URL": "https://bazaarlink.ai/api/v1",
    },
)

response = client.chat.completions.create(
    model="openai/gpt-4.1",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

LangSmith

python
import os
from openai import OpenAI

os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_API_KEY"] = "ls-YOUR_LANGSMITH_KEY"

# Use BazaarLink via LangChain with tracing enabled
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://bazaarlink.ai/api/v1",
    api_key="sk-bl-YOUR_API_KEY",
    model="openai/gpt-4.1",
)

response = llm.invoke("Hello from LangSmith + BazaarLink!")
print(response.content)

MCP Servers

Model Context Protocol (MCP) is an open standard that lets AI models connect to external tools and data sources. Through BazaarLink's MCP integration, you can give models access to custom tools.

Beta
MCP server integration is under development. In the meantime, use the standard tool calling API (tools parameter) to achieve similar functionality. Native MCP support will be available in a future release.

How MCP Works

  • Your application acts as an MCP host
  • MCP servers provide tool definitions and data access
  • Models call these tools through BazaarLink
  • Results are returned to the model to generate the final response

Current Alternative

python
# Currently: use standard tool calling to connect external tools
import json

def get_weather(city: str) -> str:
    # Your tool implementation
    return f"The weather in {city} is 25°C."

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

response = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "What's the weather in Taipei?"}],
    tools=tools,
)

# Handle tool call
if response.choices[0].finish_reason == "tool_calls":
    call = response.choices[0].message.tool_calls[0]
    args = json.loads(call.function.arguments)
    result = get_weather(**args)
Support
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
Agentic Usage — AI Agent Frameworks & Workflows