API documentation
Connect to Bamboo Relay and use multiple AI providers through one gateway.
Quick start
- Create an account and open API Keys.
- Create a key for a group that can access your chosen model. Copy the exact model ID from Models.
- Keep the key in a server environment variable. The chat API base URL is
https://api.bamboonode.cn/v1. - Send a request. Model availability, supported protocols and charges depend on your key's group and current gateway configuration.
export BAMBOO_API_KEY="YOUR_BAMBOO_API_KEY"
curl https://api.bamboonode.cn/v1/chat/completions \
-H "Authorization: Bearer $BAMBOO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_AVAILABLE_CHAT_MODEL_ID",
"messages": [{"role": "user", "content": "Hello"}]
}'Choose an integration
API reference
Request fields, responses, code examples and interactive API requests.
Application guides
Connect desktop clients, bots, translation tools and coding agents.
Structured decisions with StartLux
StartLux-Decision, trained by StartLux Labs, uses a native decision API with state and questions. Use POST /v1/decisions or its /v1/systemone alias, rather than sending a chat-completions body. See the StartLux guide and API reference.
Python SDK
For models that support the OpenAI-compatible chat API:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.bamboonode.cn/v1",
api_key=os.environ["BAMBOO_API_KEY"],
)
response = client.chat.completions.create(
model="YOUR_AVAILABLE_CHAT_MODEL_ID",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)JavaScript SDK
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.bamboonode.cn/v1",
apiKey: process.env.BAMBOO_API_KEY,
});
const response = await client.chat.completions.create({
model: "YOUR_AVAILABLE_CHAT_MODEL_ID",
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0].message.content);Authentication and errors
Use an inference key created in API Keys, not a website login token, upstream vendor secret or OAuth client secret. Requests use Authorization: Bearer YOUR_BAMBOO_API_KEY; native formats may accept the authentication headers shown in their reference pages.
401: check the inference key and its enabled state.403: check the account, key restrictions and group access.- Invalid request errors: check the selected model's protocol and required fields.
- Rate-limit or upstream errors: inspect the returned error and request ID. Avoid blindly retrying an operation that may already have generated a billable result.
See usage logs for request records and Billing for credit balances. Amounts and promotional credit follow the gateway's current configuration.
Key security and data use
Keep keys in server-side environment variables or secret storage. Do not put them in browser code, public repositories or distributed client binaries. Review our privacy notice and refund policy.
Use the language selector to switch between English and Chinese while keeping the same document URL.