1. Create a key
Sign in and create a project API key.
FlowBarAI is compatible with OpenAI SDKs. Replace the base URL, use your FlowBarAI API key, and keep your existing request format.
export OPENAI_BASE_URL="https://api.flowbarai.com/v1"
export OPENAI_API_KEY="sk-your-flowbar-key"Sign in and create a project API key.
Use the pricing page to compare supported routes.
Track balances, logs, and model cost.
LiteLLM alternatives: self-hosted vs managed LLM gateway
How to compare LLM API pricing
FlowBarAI 兼容 OpenAI SDK。替换 Base URL,使用 FlowBarAI API Key,即可保持原有请求格式接入。
export OPENAI_BASE_URL="https://api.flowbarai.com/v1"
export OPENAI_API_KEY="sk-your-flowbar-key"登录控制台,为项目创建 API Key。
在价格页比较可用模型和线路。
查看余额、日志和模型成本。
Register or sign in, create a key, and copy an authorized chat route from Models. Compare its exact billing unit on Pricing. Set FLOWBAR_API_KEY and FLOWBAR_MODEL in your server environment before running an example. The placeholder is deliberately not a real route.
Start with one short request and inspect the response and usage record before connecting production traffic. These examples issue a real billable request when valid credentials and a paid route are supplied. They use non-streaming chat completions; image, video and provider-specific features may require a different endpoint or request format.
# Set FLOWBAR_API_KEY securely in your server environment first.
export FLOWBAR_MODEL="REPLACE_WITH_AN_AUTHORIZED_CHAT_ROUTE"
curl --fail-with-body --max-time 60 https://api.flowbarai.com/v1/chat/completions \
-H "Authorization: Bearer $FLOWBAR_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<EOF
{"model":"$FLOWBAR_MODEL","messages":[{"role":"user","content":"Hello"}]}
EOF# Install: pip install openai
# Set FLOWBAR_API_KEY and FLOWBAR_MODEL in the server environment.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["FLOWBAR_API_KEY"],
base_url="https://api.flowbarai.com/v1",
timeout=60.0,
max_retries=0,
)
response = client.chat.completions.create(
model=os.environ["FLOWBAR_MODEL"],
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)// Install: npm install openai
// Run as an ES module on your server, not in browser code.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FLOWBAR_API_KEY,
baseURL: "https://api.flowbarai.com/v1",
timeout: 60000,
maxRetries: 0,
});
const response = await client.chat.completions.create({
model: process.env.FLOWBAR_MODEL,
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0].message.content);// Uses the Go standard HTTP client; no SDK dependency.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
body, err := json.Marshal(map[string]any{
"model": os.Getenv("FLOWBAR_MODEL"),
"messages": []map[string]string{{"role": "user", "content": "Hello"}},
})
if err != nil { panic(err) }
req, err := http.NewRequest("POST", "https://api.flowbarai.com/v1/chat/completions", bytes.NewReader(body))
if err != nil { panic(err) }
req.Header.Set("Authorization", "Bearer " + os.Getenv("FLOWBAR_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := (&http.Client{Timeout: 60 * time.Second}).Do(req)
if err != nil { panic(err) }
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil { panic(err) }
if res.StatusCode >= 400 { panic(fmt.Sprintf("HTTP %d: %s", res.StatusCode, data)) }
fmt.Println(string(data))
}SDK references: openai-python · openai-node. Library features and provider support can differ; validate the exact call you intend to ship.
Read both the HTTP status and the response error body. Typical HTTP meanings are listed below; the gateway or upstream may return additional details.
The SDK examples disable automatic retries so that retry behavior is explicit. A client timeout does not prove the server stopped processing: check logs before resubmitting work that could incur a second charge. Set timeouts for your selected route; the 60-second example is a client limit, not a response-time guarantee.
Use the OpenAI Python or Node.js SDK with base URL https://api.flowbarai.com/v1 and your FlowBarAI key for a supported chat route. Compatibility depends on the endpoint and model; this does not promise support for every OpenAI API feature.
Copy an exact route from the Models page and check that your account and key are authorized for it. The examples below require an authorized chat route; image and video routes are not interchangeable with chat completions.
Register or sign in to FlowBarAI, then create an API key in the console. Keep it in a server environment variable and never publish it in frontend code or a shared repository.
FlowBarAI uses prepaid USD credits and pay-as-you-go billing. Token routes can have separate input and output rates; some image or video routes use per-image or per-second prices. Check the live Pricing page for the selected route and unit.
Trial eligibility, quotas and free routes depend on the current account policy and catalog. Check the live console and Pricing page before relying on free access.
Use the console to check balance, usage and request logs. When reporting a problem, include the route, time, HTTP status and a redacted request ID if available. Never send an API key or private prompt in a public report.
注册或登录后创建密钥,在模型页复制已授权的对话路由,并在价格页核对计费单位。执行示例前,在服务端环境变量中配置 FLOWBAR_API_KEY 和 FLOWBAR_MODEL。示例中的占位符不是可调用的真实路由。
先发送一条简短请求,核对返回结果及用量记录,再接入生产流量。提供有效密钥和付费路由后,示例会产生真实计费请求。示例使用非流式对话接口;图像、视频和模型特有功能可能需要不同端点或请求格式。
# Set FLOWBAR_API_KEY securely in your server environment first.
export FLOWBAR_MODEL="REPLACE_WITH_AN_AUTHORIZED_CHAT_ROUTE"
curl --fail-with-body --max-time 60 https://api.flowbarai.com/v1/chat/completions \
-H "Authorization: Bearer $FLOWBAR_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<EOF
{"model":"$FLOWBAR_MODEL","messages":[{"role":"user","content":"Hello"}]}
EOF# Install: pip install openai
# Set FLOWBAR_API_KEY and FLOWBAR_MODEL in the server environment.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["FLOWBAR_API_KEY"],
base_url="https://api.flowbarai.com/v1",
timeout=60.0,
max_retries=0,
)
response = client.chat.completions.create(
model=os.environ["FLOWBAR_MODEL"],
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)// Install: npm install openai
// Run as an ES module on your server, not in browser code.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FLOWBAR_API_KEY,
baseURL: "https://api.flowbarai.com/v1",
timeout: 60000,
maxRetries: 0,
});
const response = await client.chat.completions.create({
model: process.env.FLOWBAR_MODEL,
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0].message.content);// Uses the Go standard HTTP client; no SDK dependency.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
body, err := json.Marshal(map[string]any{
"model": os.Getenv("FLOWBAR_MODEL"),
"messages": []map[string]string{{"role": "user", "content": "Hello"}},
})
if err != nil { panic(err) }
req, err := http.NewRequest("POST", "https://api.flowbarai.com/v1/chat/completions", bytes.NewReader(body))
if err != nil { panic(err) }
req.Header.Set("Authorization", "Bearer " + os.Getenv("FLOWBAR_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := (&http.Client{Timeout: 60 * time.Second}).Do(req)
if err != nil { panic(err) }
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil { panic(err) }
if res.StatusCode >= 400 { panic(fmt.Sprintf("HTTP %d: %s", res.StatusCode, data)) }
fmt.Println(string(data))
}SDK 参考: openai-python · openai-node. 库功能与路由支持范围可能不同,请验证实际准备上线的调用。
同时查看 HTTP 状态码与响应错误正文。以下是常见 HTTP 含义,网关或上游还可能返回具体原因。
SDK 示例关闭自动重试,便于明确控制重试行为。客户端超时不代表服务端已经停止处理;对于可能重复计费的任务,重新提交前应先检查日志。按所选路由设置超时;示例的 60 秒是客户端等待上限,不是响应速度保证。
对于支持的对话路由,可在 OpenAI Python 或 Node.js SDK 中设置 Base URL 为 https://api.flowbarai.com/v1,并使用 FlowBarAI 密钥。兼容范围取决于端点和模型,不代表支持 OpenAI API 的全部功能。
从模型页复制准确路由,并确认账户与密钥具有访问权限。下面的示例需要已授权的对话路由;图片和视频路由不能直接替换到对话接口中。
注册或登录 FlowBarAI 后,在控制台创建 API Key。将密钥保存在服务端环境变量中,避免放入浏览器前端代码或公开代码仓库。
平台采用预存 USD 余额、按量计费。Token 路由可分别收取输入与输出费用;部分图片或视频路由按张或按秒计费。请在实时价格页核对具体路由及计费单位。
试用资格、额度和免费路由取决于当前账户政策与目录。依赖免费服务前,请核对实时控制台和价格页。
可在控制台查看余额、用量和请求日志。反馈问题时提供路由、时间、HTTP 状态码及脱敏后的请求标识(如有);不要在公开反馈中发送 API Key 或私人提示词。