OpenAI 兼容网关:一个入口切换模型,按量扣费。
OpenAI 兼容网关:只改 base_url 与 api_key,用 model 字段切换本机 Ollama 或上游模型。
Base URL:http://localhost:18080/v1(生产替换为 https://gitais.com/v1)。在控制台创建 API Key,并在 Billing / 定价页为个人账户余额充值后再调用。
Python:from openai import OpenAI;client = OpenAI(base_url="http://localhost:18080/v1", api_key="hf_...");client.chat.completions.create(model="llama3.2", messages=[{"role":"user","content":"hi"}])。
Node:import OpenAI from "openai";const client = new OpenAI({ baseURL: "http://localhost:18080/v1", apiKey: "hf_..." });await client.chat.completions.create({ model: "llama3.2", messages: [{ role: "user", content: "hi" }] })。
Go:POST {base}/v1/chat/completions,Header Authorization: Bearer hf_...,Body JSON {"model":"llama3.2","messages":[{"role":"user","content":"hi"}]}。
推理按 Token 从个人账户余额扣费;同一余额还用于存储桶、收费数据集、Spaces / 训练等。余额不足返回 insufficient_quota 或拒绝预扣。
模型列表:GET /v1/models;价格目录:GET /api/v1/billing/catalog。
模型页可复制 README 徽章;GitHub 相关见 /github。