Skip to content

feat: 添加 davinci-002 和 babbage-002 模型 - #42

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
Tailen:main
Jan 3, 2024
Merged

Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
Tailen:main

Conversation

@Tailen

@Tailen Tailen commented Jan 3, 2024

Copy link
Copy Markdown
Contributor

收费截图如下

@Tailen

Tailen commented Jan 3, 2024

Copy link
Copy Markdown
Contributor Author

image

@Calcium-Ion
Calcium-Ion merged commit aa6d623 into QuantumNous:main Jan 3, 2024
sususu98 pushed a commit to sususu98/new-api that referenced this pull request Dec 1, 2025
This migration file was a duplicate entry created during PR QuantumNous#42 merge.
It was never registered in _journal.json and the fields it added
(allow_view_provider_info, non_admin_currency_display) were not
included in schema.ts or used in the codebase.

The official 0013 migration is 0013_outgoing_justin_hammer.sql which
creates the notification_settings table.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
sususu98 pushed a commit to sususu98/new-api that referenced this pull request Dec 1, 2025
Resolved conflicts:
- VERSION: Updated to 0.2.22
- public/seed/litellm-prices.json: Used main's version (more up-to-date)
- drizzle/meta/_journal.json: Kept dev's migration 0014
- src/app/v1/_lib/proxy/forwarder.ts: Merged client abort detection with proxy error handling
- Removed duplicate migration file 0013_optimal_darkhawk.sql

Changes from main:
- REST API support and notification system (PR QuantumNous#42)
- Updated LiteLLM price data
- Version bump to 0.2.22

Changes from dev:
- Provider-level proxy support (HTTP/HTTPS/SOCKS4/SOCKS5)
- API documentation enhancements
- Price table pagination
- Migration 0014 for proxy fields

All type checks passed ✅

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
feat: 添加 davinci-002 和 babbage-002 模型
jiutubaba pushed a commit to jiutubaba/fx-api that referenced this pull request May 17, 2026
lingozhi referenced this pull request in lingozhi/new-api Jul 17, 2026
Measured over 262 prod requests, all six channels serving the SAME model at the
SAME reasoning effort — so the spread is the channel, not the request:

  #41 1275ms (n=90)   #51 1328ms (n=66)   #42 2337ms (n=17)
  #33 3388ms (n=24)   #45 3537ms (n=52)   #57 8133ms (n=8)

Bucketing by uncached prompt tokens holds p50 flat (1612/1934/2073/1802 for
0-2k/2-6k/6-20k/20k+), which rules out prefill volume as the cause. Meanwhile
~100% of requests are affinity-pinned, so the health-weighted selection that was
supposed to steer around slow channels almost never runs — the only exit is
IsChannelFastEnoughForAffinity, and `score > 0.1` with `score = 1/(1+latency)`
only fires past 9s. #45 and #57 kept their sticky traffic forever; 33% of
requests were pinned to a channel 2.6x+ slower than the one next to it.

Release relative to the best peer for the same model+path instead: leave only
when the sticky is BOTH slower than 2s absolute and >2x that peer. The absolute
floor stops churn over gaps nobody can feel (0.3s vs 0.15s is 2x), the ratio
stops churn for gains too small to repay a migration. #42 at 1.83x stays.

The reason this could not just be turned on: migration causes a cold prompt
cache by construction, and a cold 240k-token prefill measured 23348ms. That one
number breaks two mechanisms at once, both of which then punish the channel we
just chose *for being the fastest*:

  - the latency EWMA, which is shared by every affinity key on the channel, so
    one migration would make the destination look slow to all of them and
    stampede them off it, each paying its own cold prefill;
  - cooldownSlowChannelIfNeeded, an entirely separate path that yanks a channel
    out of rotation for 30 minutes past 30s FRT — 23.3s is 78% of that.

So the release is gated three ways. ColdCacheStart marks the attempt and keeps
its latency out of both mechanisms (failures still count — a cold start is no
excuse for erroring). A per-key cooldown stops one key bouncing. A global
minimum interval drains a slow channel one key at a time, because the slow
verdict is per-channel: without it every key pinned to #45 leaves on the same
tick and their cold prefills land on #41 together, making it genuinely slow —
a cascade no latency-exclusion can prevent, since that load is real.

Circuit-open releases stay unconditional and never reach AcquireChannelHealth,
or a rate-limited key would be parked on a tripped channel and a paying request
would become its half-open probe.

Accepted: weighted re-selection can hand a released key back to the same slow
channel (~12.5% by weight). Not excluded — that risks a 503, and the cache
there is still warm, so the only cost is the 10-minute slot.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
lingozhi referenced this pull request in lingozhi/new-api Jul 18, 2026
…n failure

Tracing per-session cache hits in prod exposed the real cause of the slow first
tokens. A session's first-token latency tracks one thing: whether this request
hit the upstream prompt cache. Cache hit (fresh tokens ~2.6k median) → ~1-2s.
Cache miss (fresh ~195k median) → a full 20-40s prefill. 73x apart. The upstream
KV cache lives on whichever provider served the prior turn, and affinity exists
to keep hitting it.

But the slow-channel migration added earlier fought that. When upstreams got
busy and a sticky channel's first token crossed the 9s slow bound, its circuit
tripped and affinity released the session to another channel — which had no cache
for this conversation and paid a full cold prefill. Under load every channel
trips in turn, so one session churned #42->#41->#29->#17, a 10-26s cold prefill
on every hop, then ran at 1-2s once it finally settled. The migration meant to
escape slowness was manufacturing it: leaving a slow-but-warm channel for a
cold one is strictly worse, because a cache hit is fast even on a slow channel.

So affinity now distinguishes why a channel is unavailable. openWithBackoff
records whether the circuit tripped on slowness or on failures.
AcquireChannelHealthForAffinity keeps a cache-holding session on a slow-open
channel (the cache still makes it fast, and unlike the normal acquire it is not
gated by the half-open probe lease) and releases only on failure-open, where
staying would just error and the relay retries anyway. Normal selection still
avoids slow-open channels, so only the already-warm session stays.

This removes the whole slow-migration mechanism it supersedes: ChannelAffinityDecision
/ ReleaseSlow, the best-peer scan, and the per-key/global release rate limiters
(service.TryReleaseChannelAffinity and friends). The fast-channel selection boost
stays — it helps a genuinely new or failed-over request pick a fast channel,
where there is no cache to lose. ColdCacheStart stays too: leaving a failing
channel still lands cold, and that prefill must not poison the new channel.

Test rides a session through a slow-open channel (must stay) and a failure-open
channel (must leave); it fails if slow-open is treated as unavailable.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zhibisora added a commit to zhibisora/new-api that referenced this pull request Jul 22, 2026
(cherry picked from commit c8cbd5a69b1602aab81bcc7f08d8a90765a6bbb5)
Firesuiry pushed a commit to Firesuiry/tako-newapi that referenced this pull request Aug 27, 2026
…tomic-redemption

fix(catfk): atomically rebate checkout grants
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
feat: 添加 davinci-002 和 babbage-002 模型
diyigeboke added a commit to diyigeboke/zhongtai-api that referenced this pull request Sep 19, 2026
leicanxi added a commit to leicanxi/flowbee-api that referenced this pull request Oct 30, 2026
同步上游 363 个提交(v1.0.0-rc.26 之后约两个月)。

冲突解决原则:自有功能保留、上游架构与多语言化吸收。
关键融合点:
- 限流:保留分组级限流/共享限流器/auto 分组门禁,吸收上游 Reserve/Complete
  预留与流感知成功判定;补 ErrAutoGroupsRateLimited → 429 映射
- 计费/日志:吸收上游 *LogOther 结构化与 Message 日志,保留 BillingSource
  与邀请人首充奖励(积分),RecordLog 调用全部迁移到 NewMessage
- 签到:保留福利积分发放,错误/日志改走 i18n 消息(补 11 个后端消息 key
  与 9 个前端 NewMessage key,7 语翻译)
- 邮件:保留品牌外壳排版,文案接上游多语言(补 6+5 个 i18n key)
- 令牌用量:保留扁平 user_quota/user_used_quota 客户端契约 + 容错降级,
  吸收上游 AllowUserQuotaQuery 隐私开关与 IP 白名单
- 通知:改用上游 NotifyChannelWatchers,品牌排版随语言渲染
- 访问令牌:采用上游多令牌/scope 体系,移除旧 GenerateAccessToken;
  为福利/抽奖/赞助/生图/SSO 等自有路由补齐 scope 规则,SSO 端点仅限会话
- 移除手动划转邀请额度功能(已被自动转入余额取代:模型+控制器+路由+前端)
- 前端:保留改造QuantumNous#4/QuantumNous#19/QuantumNous#22/QuantumNous#30/QuantumNous#34/QuantumNous#39/QuantumNous#42/QuantumNous#44,吸收上游组件重构;
  theme 契约测试适配站点默认值(Anthropic/sans/xl)
- 移除与改造QuantumNous#42 布局不兼容的上游概览向导 UI 测试

验证:go build/test 全绿,relaykit 独立构建通过,tsgo 零错误,
rsbuild 构建通过,vitest 2461/2461 通过。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants