API Docs

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"

1. Create a key

Sign in and create a project API key.

2. Pick a model

Use the pricing page to compare supported routes.

3. Monitor usage

Track balances, logs, and model cost.

Referral rewards / 邀请奖励

Invite a new user. After their first top-up of $10+, both accounts receive $2 credit. 邀请新用户首充满 10 美元后,双方各得 2 美元额度。

Invite / 邀请

Connect a chat route

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.

Server-side examples

cURL (Bash)

# 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

Python

# 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)

Node.js

// 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);

Go (HTTP)

// 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.

Errors, timeouts and retries

Read both the HTTP status and the response error body. Typical HTTP meanings are listed below; the gateway or upstream may return additional details.

  • 400: check JSON, model identifier and supported parameters.
  • 401 or 403: check the key, route authorization and account access; repeatedly retrying will not fix credentials.
  • 429: inspect quota or rate-limit details; honor Retry-After if provided and use bounded exponential backoff with jitter.
  • 5xx: a gateway or upstream error may be transient. Record a redacted request ID and use limited retries only when duplicate processing is acceptable.

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.

Frequently asked questions

Can I use an OpenAI SDK?

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.

Where do I find a model identifier?

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.

How do I create an API key?

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.

How is usage billed?

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.

Is free access guaranteed?

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.

Where can I review usage or an error?

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.

More developer guides