Documentation Index
Fetch the complete documentation index at: https://docs.arouter.ai/llms.txt
Use this file to discover all available pages before exploring further.
ARouter 支持可选的 HTTP 请求头,用于在 API 请求中标识您的应用。这些请求头用于 ARouter Dashboard 中的来源追踪,帮助您获取单个账户下多个项目或工作流的每应用分析和使用量统计。
请求头
HTTP-Referer
您应用的 URL,用于标识请求来源。
HTTP-Referer: https://myapp.com
X-Title
您应用的显示名称,在 Dashboard 活动视图中显示。
在任何发送到 ARouter API 的请求中包含这些请求头:
Python (OpenAI)
Node.js (OpenAI)
Go
cURL
fetch
from openai import OpenAI
client = OpenAI(
base_url="https://api.arouter.ai/v1",
api_key="lr_live_xxxx",
default_headers={
"HTTP-Referer": "https://myapp.com",
"X-Title": "My AI App",
},
)
response = client.chat.completions.create(
model="openai/gpt-5.4",
messages=[{"role": "user", "content": "Hello!"}],
)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.arouter.ai/v1",
apiKey: "lr_live_xxxx",
defaultHeaders: {
"HTTP-Referer": "https://myapp.com",
"X-Title": "My AI App",
},
});
const response = await client.chat.completions.create({
model: "openai/gpt-5.4",
messages: [{ role: "user", content: "Hello!" }],
});
client := arouter.NewClient("lr_live_xxxx",
arouter.WithBaseURL("https://api.arouter.ai/v1"),
arouter.WithHeader("HTTP-Referer", "https://myapp.com"),
arouter.WithHeader("X-Title", "My AI App"),
)
curl https://api.arouter.ai/v1/chat/completions \
-H "Authorization: Bearer lr_live_xxxx" \
-H "HTTP-Referer: https://myapp.com" \
-H "X-Title: My AI App" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.4",
"messages": [{"role": "user", "content": "Hello!"}]
}'
const response = await fetch('https://api.arouter.ai/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer lr_live_xxxx',
'HTTP-Referer': 'https://myapp.com',
'X-Title': 'My AI App',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'openai/gpt-5.4',
messages: [{ role: 'user', content: 'Hello!' }],
}),
});
应用类别
将您的应用分类,使其在 ARouter 分析中正确显示:
| 类别 | 说明 |
|---|
Coding | 开发工具、IDE、代码助手 |
Creative | 写作、图像生成、艺术工具 |
Productivity | 文档处理、摘要提取、自动化 |
Research | 知识检索、分析、学术工具 |
Entertainment | 游戏、聊天、角色扮演 |
Other | 不属于以上类别的其他应用 |
在 X-Title 请求头中附上类别,或使用集成支持的专用请求头。类别将与应用名称一同显示在 Dashboard 分析中。
Dashboard 活动
包含归因请求头后,ARouter Dashboard 将显示:
- 应用名称:在活动流和每个请求的分析中显示
- 来源 URL:用于按应用域名对请求进行分组
- 类别:在按应用类型的使用量统计中显示
- 每应用使用量:归因应用的 Token 消耗、成本和请求量
在以下情况下特别有用:
- 在同一账户下管理多个应用
- 跨不同应用版本进行 A/B 测试
- 了解哪些工作流产生了最多的使用量
归因的好处
- 按应用统计使用量 — 查看哪个应用消耗了最多的 Token 和成本
- 流量分析 — 了解每个应用的请求量模式
- 优化信号 — 识别高成本工作流以进行优化
归因请求头仅在 ARouter 侧处理,不影响模型行为、路由或上游服务商。