From 324d9fa07282bda78be8d21fe63366e3cdd2b202 Mon Sep 17 00:00:00 2001 From: Jetha Chan Date: Fri, 17 Jul 2026 17:53:39 +0900 Subject: [PATCH 1/3] feat: add ai& spend provider Sum 30-day organization spend from ai&'s documented request-log API with an org-scoped API key (AIAND_API_KEY or ~/.codexbar/config.json), parsing per-request cost strings as exact decimals in the org's billing currency and following dual-cursor pagination capped at 10 pages (capped totals are labeled partial, never silently truncated). ai& is prepaid with no quota windows, so the snapshot carries only the cost figure and no rate windows. Covers descriptor, fetcher, settings reader/store, registries, widget and CLI switches, provider icon, and fixture-based tests. --- README.md | 2 +- .../AiAnd/AiAndProviderImplementation.swift | 52 +++ .../Providers/AiAnd/AiAndSettingsStore.swift | 14 + .../ProviderImplementationRegistry.swift | 1 + .../CodexBar/Resources/ProviderIcon-aiand.svg | 6 + Sources/CodexBar/UsageStore.swift | 4 +- Sources/CodexBarCLI/CLIDiagnoseCommand.swift | 2 + .../Config/ProviderConfigEnvironment.swift | 4 +- .../Generated/CodexParserHash.generated.swift | 2 +- .../AiAnd/AiAndProviderDescriptor.swift | 66 +++ .../Providers/AiAnd/AiAndSettingsReader.swift | 24 + .../Providers/AiAnd/AiAndUsageFetcher.swift | 225 +++++++++ .../Providers/ProviderDescriptor.swift | 1 + .../CodexBarCore/Providers/Providers.swift | 2 + .../Vendored/CostUsage/CostUsageScanner.swift | 2 +- .../CodexBarWidgetProvider.swift | 1 + .../CodexBarWidget/CodexBarWidgetViews.swift | 3 + Tests/CodexBarTests/AiAndProviderTests.swift | 433 ++++++++++++++++++ docs/configuration.md | 2 +- docs/index.html | 6 +- docs/llms.txt | 4 +- docs/providers.md | 2 +- docs/site-locales.mjs | 138 +++--- docs/social.html | 2 +- 24 files changed, 916 insertions(+), 82 deletions(-) create mode 100644 Sources/CodexBar/Providers/AiAnd/AiAndProviderImplementation.swift create mode 100644 Sources/CodexBar/Providers/AiAnd/AiAndSettingsStore.swift create mode 100644 Sources/CodexBar/Resources/ProviderIcon-aiand.svg create mode 100644 Sources/CodexBarCore/Providers/AiAnd/AiAndProviderDescriptor.swift create mode 100644 Sources/CodexBarCore/Providers/AiAnd/AiAndSettingsReader.swift create mode 100644 Sources/CodexBarCore/Providers/AiAnd/AiAndUsageFetcher.swift create mode 100644 Tests/CodexBarTests/AiAndProviderTests.swift diff --git a/README.md b/README.md index 382a165691..bf39cc24fe 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![License: MIT](https://img.shields.io/badge/license-MIT-6e5aff?style=flat-square)](LICENSE) [![Site](https://img.shields.io/badge/site-codexbar.app-16d3b4?style=flat-square)](https://codexbar.app) -CodexBar — every AI coding limit in your menu bar. 61 providers. +CodexBar — every AI coding limit in your menu bar. 62 providers. Tiny macOS 14+ menu bar app that keeps **AI coding-provider limits visible** and shows when each window resets. Codex, OpenAI, Claude, Cursor, Gemini, Copilot, Grok, GroqCloud, ElevenLabs, Deepgram, z.ai, MiniMax, Kiro, Zed, Vertex AI, Augment, OpenRouter, LiteLLM, LLM Proxy, Codebuff, Command Code, ClinePass, AWS Bedrock, and many newer coding providers. One status item per provider, or Merge Icons mode with a provider switcher. No Dock icon, minimal UI, dynamic bar icons. diff --git a/Sources/CodexBar/Providers/AiAnd/AiAndProviderImplementation.swift b/Sources/CodexBar/Providers/AiAnd/AiAndProviderImplementation.swift new file mode 100644 index 0000000000..34baab3658 --- /dev/null +++ b/Sources/CodexBar/Providers/AiAnd/AiAndProviderImplementation.swift @@ -0,0 +1,52 @@ +import AppKit +import CodexBarCore +import Foundation + +struct AiAndProviderImplementation: ProviderImplementation { + let id: UsageProvider = .aiand + + @MainActor + func presentation(context _: ProviderPresentationContext) -> ProviderPresentation { + ProviderPresentation { _ in "api" } + } + + @MainActor + func observeSettings(_ settings: SettingsStore) { + _ = settings.aiAndAPIKey + } + + @MainActor + func isAvailable(context: ProviderAvailabilityContext) -> Bool { + if AiAndSettingsReader.apiKey(environment: context.environment) != nil { + return true + } + return !context.settings.aiAndAPIKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + } + + @MainActor + func settingsFields(context: ProviderSettingsContext) -> [ProviderSettingsFieldDescriptor] { + [ + ProviderSettingsFieldDescriptor( + id: "aiand-api-key", + title: "API key", + subtitle: "Stored in CodexBar's config file. Create a key in the ai& console (shown once).", + kind: .secure, + placeholder: "sk-…", + binding: context.stringBinding(\.aiAndAPIKey), + actions: [ + ProviderSettingsActionDescriptor( + id: "aiand-open-console", + title: "Open ai& Console", + style: .link, + isVisible: nil, + perform: { + if let url = URL(string: "https://console.aiand.com") { + NSWorkspace.shared.open(url) + } + }), + ], + isVisible: nil, + onActivate: nil), + ] + } +} diff --git a/Sources/CodexBar/Providers/AiAnd/AiAndSettingsStore.swift b/Sources/CodexBar/Providers/AiAnd/AiAndSettingsStore.swift new file mode 100644 index 0000000000..73e5b26b24 --- /dev/null +++ b/Sources/CodexBar/Providers/AiAnd/AiAndSettingsStore.swift @@ -0,0 +1,14 @@ +import CodexBarCore +import Foundation + +extension SettingsStore { + var aiAndAPIKey: String { + get { self.configSnapshot.providerConfig(for: .aiand)?.sanitizedAPIKey ?? "" } + set { + self.updateProviderConfig(provider: .aiand) { entry in + entry.apiKey = self.normalizedConfigValue(newValue) + } + self.logSecretUpdate(provider: .aiand, field: "apiKey", value: newValue) + } + } +} diff --git a/Sources/CodexBar/Providers/Shared/ProviderImplementationRegistry.swift b/Sources/CodexBar/Providers/Shared/ProviderImplementationRegistry.swift index 086a3b77b9..a62a05fe67 100644 --- a/Sources/CodexBar/Providers/Shared/ProviderImplementationRegistry.swift +++ b/Sources/CodexBar/Providers/Shared/ProviderImplementationRegistry.swift @@ -74,6 +74,7 @@ enum ProviderImplementationRegistry { case .sub2api: Sub2APIProviderImplementation() case .wayfinder: WayfinderProviderImplementation() case .zenmux: ZenMuxProviderImplementation() + case .aiand: AiAndProviderImplementation() } } diff --git a/Sources/CodexBar/Resources/ProviderIcon-aiand.svg b/Sources/CodexBar/Resources/ProviderIcon-aiand.svg new file mode 100644 index 0000000000..68cba8283f --- /dev/null +++ b/Sources/CodexBar/Resources/ProviderIcon-aiand.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Sources/CodexBar/UsageStore.swift b/Sources/CodexBar/UsageStore.swift index 33410e70ce..cadf6d1bbe 100644 --- a/Sources/CodexBar/UsageStore.swift +++ b/Sources/CodexBar/UsageStore.swift @@ -968,6 +968,7 @@ extension UsageStore { .wayfinder: "Wayfinder debug log not yet implemented", .sub2api: "sub2api debug log not yet implemented", .zenmux: "ZenMux debug log not yet implemented", + .aiand: "ai& debug log not yet implemented", ] let buildText = { switch provider { @@ -1046,7 +1047,8 @@ extension UsageStore { .copilot, .devin, .vertexai, .kilo, .kiro, .kimi, .moonshot, .jetbrains, .perplexity, .mimo, .doubao, .sakana, .abacus, .mistral, .codebuff, .crof, .windsurf, .venice, .manus, .commandcode, .qoder, .stepfun, .bedrock, .grok, .groq, .t3chat, .llmproxy, .litellm, .zed, - .deepgram, .poe, .chutes, .neuralwatt, .clawrouter, .longcat, .wayfinder, .sub2api, .zenmux: + .deepgram, .poe, .chutes, .neuralwatt, .clawrouter, .longcat, .wayfinder, .sub2api, .zenmux, + .aiand: return unimplementedDebugLogMessages[provider] ?? "Debug log not yet implemented" } } diff --git a/Sources/CodexBarCLI/CLIDiagnoseCommand.swift b/Sources/CodexBarCLI/CLIDiagnoseCommand.swift index cac677f0ab..cf80e58b97 100644 --- a/Sources/CodexBarCLI/CLIDiagnoseCommand.swift +++ b/Sources/CodexBarCLI/CLIDiagnoseCommand.swift @@ -227,6 +227,8 @@ extension CodexBarCLI { ChutesSettingsReader.apiKey(environment: environment) != nil case .zenmux: ZenMuxSettingsReader.managementAPIKey(environment: environment) != nil + case .aiand: + AiAndSettingsReader.apiKey(environment: environment) != nil case .crof: CrofSettingsReader.apiKey(environment: environment) != nil case .deepgram: diff --git a/Sources/CodexBarCore/Config/ProviderConfigEnvironment.swift b/Sources/CodexBarCore/Config/ProviderConfigEnvironment.swift index 54eafae7f3..1f7bd27d84 100644 --- a/Sources/CodexBarCore/Config/ProviderConfigEnvironment.swift +++ b/Sources/CodexBarCore/Config/ProviderConfigEnvironment.swift @@ -185,7 +185,7 @@ public enum ProviderConfigEnvironment { GroqSettingsReader.apiKeyEnvironmentKey case .llmproxy: LLMProxySettingsReader.apiKeyEnvironmentKey - case .chutes, .poe, .litellm, .clawrouter, .factory, .sub2api, .neuralwatt, .zenmux: + case .chutes, .poe, .litellm, .clawrouter, .factory, .sub2api, .neuralwatt, .zenmux, .aiand: self.additionalAPIKeyEnvironmentKey(for: provider) default: nil @@ -210,6 +210,8 @@ public enum ProviderConfigEnvironment { FactorySettingsReader.apiTokenKey case .zenmux: ZenMuxSettingsReader.managementAPIKeyEnvironmentKey + case .aiand: + AiAndSettingsReader.apiKeyEnvironmentKey default: nil } diff --git a/Sources/CodexBarCore/Generated/CodexParserHash.generated.swift b/Sources/CodexBarCore/Generated/CodexParserHash.generated.swift index 719467e950..460571c02d 100644 --- a/Sources/CodexBarCore/Generated/CodexParserHash.generated.swift +++ b/Sources/CodexBarCore/Generated/CodexParserHash.generated.swift @@ -1,5 +1,5 @@ // Generated by Scripts/regenerate-codex-parser-hash.sh. Do not edit by hand. enum CodexParserHash { - static let value = "2d056ae5a24d5157" + static let value = "011e4792f1671ebe" } diff --git a/Sources/CodexBarCore/Providers/AiAnd/AiAndProviderDescriptor.swift b/Sources/CodexBarCore/Providers/AiAnd/AiAndProviderDescriptor.swift new file mode 100644 index 0000000000..97ad028afe --- /dev/null +++ b/Sources/CodexBarCore/Providers/AiAnd/AiAndProviderDescriptor.swift @@ -0,0 +1,66 @@ +import Foundation + +public enum AiAndProviderDescriptor { + public static let descriptor: ProviderDescriptor = Self.makeDescriptor() + + static func makeDescriptor() -> ProviderDescriptor { + ProviderDescriptor( + id: .aiand, + metadata: ProviderMetadata( + id: .aiand, + displayName: "ai&", + sessionLabel: "Spend", + weeklyLabel: "Spend", + opusLabel: nil, + supportsOpus: false, + supportsCredits: false, + creditsHint: "", + toggleTitle: "Show ai& usage", + cliName: "aiand", + defaultEnabled: false, + dashboardURL: "https://console.aiand.com", + statusPageURL: nil), + branding: ProviderBranding( + iconStyle: .aiand, + iconResourceName: "ProviderIcon-aiand", + color: ProviderColor(red: 226 / 255, green: 92 / 255, blue: 43 / 255), + confettiPalette: [ + ProviderColor(hex: 0xE25C2B), + ProviderColor(hex: 0xF2A17E), + ProviderColor(hex: 0x33231C), + ]), + tokenCost: ProviderTokenCostConfig( + supportsTokenCost: false, + noDataMessage: { "ai& spend is summed from the request logs API." }), + fetchPlan: ProviderFetchPlan( + sourceModes: [.auto, .api], + pipeline: ProviderFetchPipeline(resolveStrategies: { _ in [AiAndAPIFetchStrategy()] })), + cli: ProviderCLIConfig( + name: "aiand", + aliases: ["ai&", "ai-and"], + versionDetector: nil)) + } +} + +struct AiAndAPIFetchStrategy: ProviderFetchStrategy { + let id = "aiand.api" + let kind: ProviderFetchKind = .apiToken + + func isAvailable(_ context: ProviderFetchContext) async -> Bool { + AiAndSettingsReader.apiKey(environment: context.env) != nil + } + + func fetch(_ context: ProviderFetchContext) async throws -> ProviderFetchResult { + guard let credential = AiAndSettingsReader.apiKey(environment: context.env) else { + throw AiAndUsageError.notConfigured + } + let usage = try await AiAndUsageFetcher.fetchUsage(credential) + return self.makeResult( + usage: usage.toUsageSnapshot(), + sourceLabel: "api") + } + + func shouldFallback(on _: Error, context _: ProviderFetchContext) -> Bool { + false + } +} diff --git a/Sources/CodexBarCore/Providers/AiAnd/AiAndSettingsReader.swift b/Sources/CodexBarCore/Providers/AiAnd/AiAndSettingsReader.swift new file mode 100644 index 0000000000..8f0cc3cfd3 --- /dev/null +++ b/Sources/CodexBarCore/Providers/AiAnd/AiAndSettingsReader.swift @@ -0,0 +1,24 @@ +import Foundation + +public enum AiAndSettingsReader { + public static let apiKeyEnvironmentKey = "AIAND_API_KEY" + + public static func apiKey( + environment: [String: String] = ProcessInfo.processInfo.environment) -> String? + { + self.cleaned(environment[self.apiKeyEnvironmentKey]) + } + + static func cleaned(_ raw: String?) -> String? { + guard var value = raw?.trimmingCharacters(in: .whitespacesAndNewlines), !value.isEmpty else { + return nil + } + if (value.hasPrefix("\"") && value.hasSuffix("\"")) || + (value.hasPrefix("'") && value.hasSuffix("'")) + { + value = String(value.dropFirst().dropLast()) + } + value = value.trimmingCharacters(in: .whitespacesAndNewlines) + return value.isEmpty ? nil : value + } +} diff --git a/Sources/CodexBarCore/Providers/AiAnd/AiAndUsageFetcher.swift b/Sources/CodexBarCore/Providers/AiAnd/AiAndUsageFetcher.swift new file mode 100644 index 0000000000..d9e83c5fd8 --- /dev/null +++ b/Sources/CodexBarCore/Providers/AiAnd/AiAndUsageFetcher.swift @@ -0,0 +1,225 @@ +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +public enum AiAndUsageError: LocalizedError, Sendable, Equatable { + case notConfigured + case invalidAPIKey + case insufficientCredits + case rateLimited + case apiError(Int) + case parseFailed(String) + + public var errorDescription: String? { + switch self { + case .notConfigured: + "Missing ai& API key. Add one in Settings or set AIAND_API_KEY." + case .invalidAPIKey: + "ai& rejected the API key. Create a new key at console.aiand.com and update Settings." + case .insufficientCredits: + "ai& reports the organization is out of credits. Top up at console.aiand.com." + case .rateLimited: + "ai& rate limit exceeded. Usage will refresh on the next cycle." + case let .apiError(statusCode): + "ai& logs API returned HTTP \(statusCode)." + case let .parseFailed(message): + "Could not parse ai& usage: \(message)" + } + } +} + +public struct AiAndUsageSnapshot: Sendable, Equatable { + public struct Spend: Sendable, Equatable { + public let amount: Decimal + public let currencyCode: String + + public init(amount: Decimal, currencyCode: String) { + self.amount = amount + self.currencyCode = currencyCode + } + } + + /// Nil when the window has no priced rows: the org's billing currency is only + /// observable from log rows, so an empty window has no currency to report in. + public let last30DaysSpend: Spend? + /// False when the request-log page cap was hit before reaching the end of the + /// 30-day window, so the sum only covers the newest requests. + public let isComplete: Bool + public let updatedAt: Date + + public init(last30DaysSpend: Spend?, isComplete: Bool, updatedAt: Date) { + self.last30DaysSpend = last30DaysSpend + self.isComplete = isComplete + self.updatedAt = updatedAt + } + + public func toUsageSnapshot() -> UsageSnapshot { + // ai& is prepaid with no quota windows; spend is the only usable usage + // signal, so no RateWindows are synthesized. limit 0 means "no cap". + UsageSnapshot( + primary: nil, + secondary: nil, + providerCost: self.last30DaysSpend.map { spend in + ProviderCostSnapshot( + used: NSDecimalNumber(decimal: spend.amount).doubleValue, + limit: 0, + currencyCode: spend.currencyCode, + period: self.isComplete ? "Last 30 days" : "Last 30 days (partial)", + updatedAt: self.updatedAt) + }, + updatedAt: self.updatedAt, + identity: nil, + dataConfidence: self.isComplete ? .exact : .estimated) + } +} + +public enum AiAndUsageFetcher { + static let logsBaseURL = URL(string: "https://api.aiand.com/logs")! + static let pageLimit = 100 + /// ai& log rows are per-request, so 10 pages covers the newest 1,000 requests + /// of the 30-day window (Poe caps its per-message history at 5 pages). + public static let maxPages = 10 + private static let requestTimeoutSeconds: TimeInterval = 15 + + public static func fetchUsage( + _ rawCredential: String, + transport: any ProviderHTTPTransport = ProviderHTTPClient.shared, + now: Date = Date()) async throws -> AiAndUsageSnapshot + { + guard let credential = AiAndSettingsReader.cleaned(rawCredential) else { + throw AiAndUsageError.notConfigured + } + + var rows: [LogsEnvelope.Row] = [] + var after: String? + var afterID: String? + var isComplete = false + + for _ in 0.. LogsEnvelope + { + var request = URLRequest(url: self.logsURL(after: after, afterID: afterID)) + request.httpMethod = "GET" + request.timeoutInterval = self.requestTimeoutSeconds + request.setValue("Bearer \(credential)", forHTTPHeaderField: "Authorization") + request.setValue("application/json", forHTTPHeaderField: "Accept") + + let response = try await transport.response(for: request) + guard (200..<300).contains(response.statusCode) else { + throw self.error(statusCode: response.statusCode) + } + do { + return try JSONDecoder().decode(LogsEnvelope.self, from: response.data) + } catch { + throw AiAndUsageError.parseFailed(error.localizedDescription) + } + } + + private static func logsURL(after: String?, afterID: String?) -> URL { + var components = URLComponents(url: self.logsBaseURL, resolvingAgainstBaseURL: false)! + var query = [ + URLQueryItem(name: "range", value: "30days"), + URLQueryItem(name: "limit", value: String(self.pageLimit)), + ] + if let after { + query.append(URLQueryItem(name: "after", value: after)) + } + if let afterID { + query.append(URLQueryItem(name: "after_id", value: afterID)) + } + components.queryItems = query + // Cursor timestamps carry a "+00" offset; URLComponents leaves "+" bare in + // queries, which servers decode as a space, so escape it explicitly. + components.percentEncodedQuery = components.percentEncodedQuery? + .replacingOccurrences(of: "+", with: "%2B") + return components.url! + } + + private static func summarize( + rows: [LogsEnvelope.Row], + isComplete: Bool, + now: Date) -> AiAndUsageSnapshot + { + // Rows arrive newest-first; the newest priced row decides the display + // currency, and only rows in that currency are summed. + var currency: String? + var total = Decimal(0) + for row in rows { + guard let rawCost = row.cost, + let cost = Decimal(string: rawCost), + let rowCurrency = row.currency?.trimmingCharacters(in: .whitespacesAndNewlines).lowercased(), + !rowCurrency.isEmpty + else { continue } + if currency == nil { + currency = rowCurrency + } + guard rowCurrency == currency else { continue } + total += cost + } + return AiAndUsageSnapshot( + last30DaysSpend: currency.map { code in + AiAndUsageSnapshot.Spend(amount: total, currencyCode: code.uppercased()) + }, + isComplete: isComplete, + updatedAt: now) + } + + private static func error(statusCode: Int) -> AiAndUsageError { + switch statusCode { + case 401: + .invalidAPIKey + case 402: + .insufficientCredits + case 429: + .rateLimited + default: + .apiError(statusCode) + } + } +} + +private struct LogsEnvelope: Decodable { + struct Row: Decodable { + let cost: String? + let currency: String? + } + + let data: [Row] + let hasMore: Bool? + let nextAfter: String? + let nextAfterID: String? + + enum CodingKeys: String, CodingKey { + case data + case hasMore = "has_more" + case nextAfter = "next_after" + case nextAfterID = "next_after_id" + } +} diff --git a/Sources/CodexBarCore/Providers/ProviderDescriptor.swift b/Sources/CodexBarCore/Providers/ProviderDescriptor.swift index 55ee9ec9ad..9da706865b 100644 --- a/Sources/CodexBarCore/Providers/ProviderDescriptor.swift +++ b/Sources/CodexBarCore/Providers/ProviderDescriptor.swift @@ -114,6 +114,7 @@ public enum ProviderDescriptorRegistry { .sub2api: Sub2APIProviderDescriptor.descriptor, .wayfinder: WayfinderProviderDescriptor.descriptor, .zenmux: ZenMuxProviderDescriptor.descriptor, + .aiand: AiAndProviderDescriptor.descriptor, ] private static let bootstrap: Void = { for provider in UsageProvider.allCases { diff --git a/Sources/CodexBarCore/Providers/Providers.swift b/Sources/CodexBarCore/Providers/Providers.swift index 91789f91f7..df96c0ac6d 100644 --- a/Sources/CodexBarCore/Providers/Providers.swift +++ b/Sources/CodexBarCore/Providers/Providers.swift @@ -64,6 +64,7 @@ public enum UsageProvider: String, CaseIterable, Sendable, Codable { case sub2api case wayfinder case zenmux + case aiand } // swiftformat:enable sortDeclarations @@ -128,6 +129,7 @@ public enum IconStyle: String, Sendable, CaseIterable { case sub2api case wayfinder case zenmux + case aiand case combined } diff --git a/Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner.swift b/Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner.swift index dcd3b422af..fc8a2b3398 100644 --- a/Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner.swift +++ b/Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner.swift @@ -830,7 +830,7 @@ enum CostUsageScanner { .ollama, .t3chat, .synthetic, .openrouter, .elevenlabs, .warp, .perplexity, .mimo, .doubao, .sakana, .abacus, .mistral, .deepseek, .codebuff, .crof, .windsurf, .zed, .venice, .commandcode, .qoder, .stepfun, .bedrock, .grok, .groq, .llmproxy, .litellm, .deepgram, .poe, .chutes, .neuralwatt, .clawrouter, - .longcat, .sub2api, .wayfinder, .zenmux: + .longcat, .sub2api, .wayfinder, .zenmux, .aiand: return emptyReport } } diff --git a/Sources/CodexBarWidget/CodexBarWidgetProvider.swift b/Sources/CodexBarWidget/CodexBarWidgetProvider.swift index 10feb9987d..6fc5c0d2ee 100644 --- a/Sources/CodexBarWidget/CodexBarWidgetProvider.swift +++ b/Sources/CodexBarWidget/CodexBarWidgetProvider.swift @@ -127,6 +127,7 @@ enum ProviderChoice: String, AppEnum { case .zed: return nil // Zed not yet supported in widgets case .neuralwatt: return nil // Neuralwatt not yet supported in widgets case .zenmux: return nil // ZenMux not yet supported in widgets + case .aiand: return nil // ai& not yet supported in widgets } } } diff --git a/Sources/CodexBarWidget/CodexBarWidgetViews.swift b/Sources/CodexBarWidget/CodexBarWidgetViews.swift index 00e026b68e..e550cab4dc 100644 --- a/Sources/CodexBarWidget/CodexBarWidgetViews.swift +++ b/Sources/CodexBarWidget/CodexBarWidgetViews.swift @@ -362,6 +362,7 @@ private struct ProviderSwitchChip: View { case .zed: "Zed" case .neuralwatt: "Neuralwatt" case .zenmux: "ZenMux" + case .aiand: "ai&" } } } @@ -1106,6 +1107,8 @@ enum WidgetColors { Color(red: 56 / 255, green: 217 / 255, blue: 140 / 255) case .zenmux: Color(red: 108 / 255, green: 92 / 255, blue: 231 / 255) + case .aiand: + Color(red: 226 / 255, green: 92 / 255, blue: 43 / 255) } } } diff --git a/Tests/CodexBarTests/AiAndProviderTests.swift b/Tests/CodexBarTests/AiAndProviderTests.swift new file mode 100644 index 0000000000..6232dc6c71 --- /dev/null +++ b/Tests/CodexBarTests/AiAndProviderTests.swift @@ -0,0 +1,433 @@ +import CodexBarCore +import Foundation +import Testing +@testable import CodexBar + +struct AiAndProviderTests { + @Test + func `single log page maps to summed spend in the org billing currency`() async throws { + let now = Date(timeIntervalSince1970: 1_800_000_000) + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + #expect(request.httpMethod == "GET") + #expect(request.value(forHTTPHeaderField: "Authorization") == "Bearer sk-test-fixture") + #expect(request.value(forHTTPHeaderField: "Accept") == "application/json") + #expect(url.absoluteString == "https://api.aiand.com/logs?range=30days&limit=100") + #expect(url.scheme == "https") + #expect(url.host == "api.aiand.com") + #expect(url.user == nil) + #expect(url.password == nil) + #expect(url.fragment == nil) + return Self.response(url: url, body: Self.finalPageFixture) + } + + let usage = try await AiAndUsageFetcher.fetchUsage( + "sk-test-fixture", + transport: transport, + now: now) + let snapshot = usage.toUsageSnapshot() + + // "7.02344000" + "1.10000000"; the null-cost row is skipped. + #expect(usage.last30DaysSpend?.amount == Decimal(string: "8.12344")) + #expect(usage.last30DaysSpend?.currencyCode == "JPY") + #expect(usage.isComplete) + #expect(snapshot.primary == nil) + #expect(snapshot.secondary == nil) + #expect(snapshot.tertiary == nil) + #expect(snapshot.extraRateWindows == nil) + #expect(snapshot.providerCost?.limit == 0) + #expect(snapshot.providerCost?.currencyCode == "JPY") + #expect(snapshot.providerCost?.period == "Last 30 days") + #expect(snapshot.identity == nil) + #expect(snapshot.dataConfidence == .exact) + #expect(snapshot.updatedAt == now) + } + + @Test + func `pagination sends both cursors and sums across pages`() async throws { + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + let query = url.query ?? "" + if query.contains("after=") { + #expect(url.absoluteString == + "https://api.aiand.com/logs?range=30days&limit=100" + + "&after=2026-07-17%2010:24:30.094374%2B00&after_id=912bf992-0000-4000-8000-000000000002") + return Self.response(url: url, body: Self.finalPageFixture) + } + return Self.response(url: url, body: Self.firstPageFixture) + } + + let usage = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + + let requests = await transport.requests() + #expect(requests.count == 2) + let secondQuery = try #require(requests.last?.url?.query) + #expect(secondQuery.contains("after=")) + #expect(secondQuery.contains("after_id=912bf992-0000-4000-8000-000000000002")) + // Page 1: "12.00000000" + "0.50000000"; page 2: "7.02344000" + "1.10000000". + #expect(usage.last30DaysSpend?.amount == Decimal(string: "20.62344")) + #expect(usage.last30DaysSpend?.currencyCode == "JPY") + #expect(usage.isComplete) + } + + @Test + func `hitting the page cap marks the spend partial`() async throws { + let now = Date(timeIntervalSince1970: 1_800_000_000) + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: Self.firstPageFixture) + } + + let usage = try await AiAndUsageFetcher.fetchUsage( + "sk-test-fixture", + transport: transport, + now: now) + let snapshot = usage.toUsageSnapshot() + + let requests = await transport.requests() + #expect(requests.count == AiAndUsageFetcher.maxPages) + #expect(!usage.isComplete) + #expect(usage.last30DaysSpend?.amount == Decimal(string: "125.0")) + #expect(snapshot.providerCost?.period == "Last 30 days (partial)") + #expect(snapshot.dataConfidence == .estimated) + } + + @Test + func `mixed currencies keep the newest row's currency and skip the rest`() async throws { + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: Self.mixedCurrencyFixture) + } + + let usage = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + + // The newest row is JPY, so the USD row is not added to the total. + #expect(usage.last30DaysSpend?.currencyCode == "JPY") + #expect(usage.last30DaysSpend?.amount == Decimal(string: "9.5")) + } + + @Test + func `empty window omits the cost snapshot instead of guessing a currency`() async throws { + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: #"{"data": [], "has_more": false}"#) + } + + let usage = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + let snapshot = usage.toUsageSnapshot() + + // The billing currency is only observable from log rows; with none, report + // no cost at all rather than a zero in a guessed currency. + #expect(usage.last30DaysSpend == nil) + #expect(usage.isComplete) + #expect(snapshot.providerCost == nil) + } + + @Test + func `rows without a currency are skipped and alone yield no cost snapshot`() async throws { + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: Self.missingCurrencyFixture) + } + + let usage = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + + #expect(usage.last30DaysSpend == nil) + #expect(usage.toUsageSnapshot().providerCost == nil) + } + + @Test + func `decimal money strings sum exactly`() async throws { + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: Self.decimalFixture) + } + + let usage = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + + // 0.1 + 0.1 + 0.1 must be exactly 0.3 — Double summation would drift. + #expect(usage.last30DaysSpend?.amount == Decimal(string: "0.3")) + } + + @Test + func `credential is only sent as a bearer header`() async throws { + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: Self.finalPageFixture) + } + + _ = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + + let request = try #require(await transport.requests().first) + let url = try #require(request.url) + #expect(!url.absoluteString.contains("sk-test-fixture")) + #expect(request.value(forHTTPHeaderField: "Authorization") == "Bearer sk-test-fixture") + } + + @Test + func `invalid api key maps to an actionable error`() async { + let transport = Self.errorTransport(statusCode: 401, code: "invalid_api_key") + + await #expect { + _ = try await AiAndUsageFetcher.fetchUsage("sk-wrong", transport: transport) + } throws: { error in + error as? AiAndUsageError == .invalidAPIKey + } + #expect(AiAndUsageError.invalidAPIKey.errorDescription?.contains("console.aiand.com") == true) + } + + @Test + func `insufficient credits maps to an actionable error`() async { + let transport = Self.errorTransport(statusCode: 402, code: "insufficient_credits") + + await #expect { + _ = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + } throws: { error in + error as? AiAndUsageError == .insufficientCredits + } + #expect(AiAndUsageError.insufficientCredits.errorDescription?.contains("credits") == true) + } + + @Test + func `rate limit is surfaced politely`() async { + let transport = Self.errorTransport(statusCode: 429, code: "rate_limit_exceeded") + + await #expect { + _ = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + } throws: { error in + error as? AiAndUsageError == .rateLimited + } + } + + @Test + func `unexpected status is reported with its code`() async { + let transport = Self.errorTransport(statusCode: 500, code: "internal_error") + + await #expect { + _ = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + } throws: { error in + error as? AiAndUsageError == .apiError(500) + } + } + + @Test + func `missing or whitespace credential fails clearly`() async { + await #expect { + _ = try await AiAndUsageFetcher.fetchUsage(" ") + } throws: { error in + error as? AiAndUsageError == .notConfigured + } + } + + @Test + func `malformed logs payload fails parsing`() async { + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: #"{"object":"list"}"#) + } + + await #expect { + _ = try await AiAndUsageFetcher.fetchUsage("sk-test-fixture", transport: transport) + } throws: { error in + guard case .parseFailed = error as? AiAndUsageError else { return false } + return true + } + } + + @Test + func `settings reader trims whitespace and quotes`() { + #expect(AiAndSettingsReader.apiKey(environment: [ + AiAndSettingsReader.apiKeyEnvironmentKey: " 'sk-test-fixture' ", + ]) == "sk-test-fixture") + #expect(AiAndSettingsReader.apiKey(environment: [:]) == nil) + #expect(AiAndSettingsReader.apiKey(environment: [ + AiAndSettingsReader.apiKeyEnvironmentKey: " ", + ]) == nil) + } + + @Test @MainActor + func `descriptor and app registry include aiand`() throws { + let descriptor = ProviderDescriptorRegistry.descriptor(for: .aiand) + #expect(descriptor.metadata.displayName == "ai&") + #expect(descriptor.metadata.cliName == "aiand") + #expect(descriptor.metadata.defaultEnabled == false) + #expect(!descriptor.metadata.supportsCredits) + #expect(!descriptor.tokenCost.supportsTokenCost) + #expect(descriptor.fetchPlan.sourceModes == [.auto, .api]) + #expect(descriptor.cli.aliases == ["ai&", "ai-and"]) + + let implementation = try #require(ProviderImplementationRegistry.implementation(for: .aiand)) + #expect(implementation is AiAndProviderImplementation) + } + + /// Sanitized from a live `/logs` response (2026-07-18); `api_key` arrives pre-masked by the server. + private static let finalPageFixture = #""" + { + "data": [ + { + "id": "cdd2b25d-0000-4000-8000-000000000001", + "model": "zai-org/glm-5.2", + "api_key": "sk-43fd...cc4b", + "status_code": 200, + "ttft_ms": 1449, + "latency_ms": 3163, + "input_tokens": 170569, + "output_tokens": 248, + "cached_tokens": 170240, + "cost": "7.02344000", + "currency": "jpy", + "created_at": "2026-07-17 10:24:30.094374+00" + }, + { + "id": "cdd2b25d-0000-4000-8000-000000000002", + "model": "zai-org/glm-5.2", + "api_key": "sk-43fd...cc4b", + "status_code": 200, + "ttft_ms": 512, + "latency_ms": 1201, + "input_tokens": 1200, + "output_tokens": 90, + "cached_tokens": 0, + "cost": "1.10000000", + "currency": "jpy", + "created_at": "2026-07-17 10:20:00.000000+00" + }, + { + "id": "cdd2b25d-0000-4000-8000-000000000003", + "model": "zai-org/glm-5.2", + "api_key": "sk-43fd...cc4b", + "status_code": 500, + "ttft_ms": 0, + "latency_ms": 42, + "input_tokens": 0, + "output_tokens": 0, + "cached_tokens": null, + "cost": null, + "currency": "jpy", + "created_at": "2026-07-17 10:15:00.000000+00" + } + ], + "has_more": false, + "next_after": null, + "next_after_id": null + } + """# + + private static let firstPageFixture = #""" + { + "data": [ + { + "id": "912bf992-0000-4000-8000-000000000001", + "model": "zai-org/glm-5.2", + "api_key": "sk-43fd...cc4b", + "status_code": 200, + "ttft_ms": 800, + "latency_ms": 2400, + "input_tokens": 52000, + "output_tokens": 700, + "cached_tokens": 0, + "cost": "12.00000000", + "currency": "jpy", + "created_at": "2026-07-17 10:24:30.094374+00" + }, + { + "id": "912bf992-0000-4000-8000-000000000002", + "model": "zai-org/glm-5.2", + "api_key": "sk-43fd...cc4b", + "status_code": 200, + "ttft_ms": 300, + "latency_ms": 900, + "input_tokens": 2100, + "output_tokens": 55, + "cached_tokens": 0, + "cost": "0.50000000", + "currency": "jpy", + "created_at": "2026-07-17 10:24:30.094374+00" + } + ], + "has_more": true, + "next_after": "2026-07-17 10:24:30.094374+00", + "next_after_id": "912bf992-0000-4000-8000-000000000002" + } + """# + + private static let mixedCurrencyFixture = #""" + { + "data": [ + { + "id": "aaaa0000-0000-4000-8000-000000000001", + "cost": "9.50000000", + "currency": "jpy", + "created_at": "2026-07-17 10:24:30.094374+00" + }, + { + "id": "aaaa0000-0000-4000-8000-000000000002", + "cost": "1.25000000", + "currency": "usd", + "created_at": "2026-07-17 10:20:00.000000+00" + } + ], + "has_more": false, + "next_after": null, + "next_after_id": null + } + """# + + private static let missingCurrencyFixture = #""" + { + "data": [ + { + "id": "aaaa0000-0000-4000-8000-000000000003", + "cost": "4.20000000", + "currency": null, + "created_at": "2026-07-17 10:24:30.094374+00" + }, + { + "id": "aaaa0000-0000-4000-8000-000000000004", + "cost": "1.00000000", + "currency": " ", + "created_at": "2026-07-17 10:20:00.000000+00" + } + ], + "has_more": false, + "next_after": null, + "next_after_id": null + } + """# + + private static let decimalFixture = #""" + { + "data": [ + {"id": "bbbb0000-0000-4000-8000-000000000001", "cost": "0.10000000", "currency": "jpy"}, + {"id": "bbbb0000-0000-4000-8000-000000000002", "cost": "0.10000000", "currency": "jpy"}, + {"id": "bbbb0000-0000-4000-8000-000000000003", "cost": "0.10000000", "currency": "jpy"} + ], + "has_more": false, + "next_after": null, + "next_after_id": null + } + """# + + private static func errorTransport(statusCode: Int, code: String) -> ProviderHTTPTransportStub { + ProviderHTTPTransportStub { request in + let url = try #require(request.url) + let body = #""" + {"error":{"message":"fixture error","type":"fixture","param":null,"code":"\#(code)"}} + """# + return Self.response(url: url, body: body, statusCode: statusCode) + } + } + + private static func response( + url: URL, + body: String, + statusCode: Int = 200) -> (Data, URLResponse) + { + let response = HTTPURLResponse( + url: url, + statusCode: statusCode, + httpVersion: "HTTP/1.1", + headerFields: ["Content-Type": "application/json"])! + return (Data(body.utf8), response) + } +} diff --git a/docs/configuration.md b/docs/configuration.md index 7ff767164e..78adee2fc0 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -264,7 +264,7 @@ z.ai team accounts also use `usageScope`, `organizationId`, and `workspaceID`; s ## Provider IDs Current IDs (see `Sources/CodexBarCore/Providers/Providers.swift`): -`codex`, `openai`, `azureopenai`, `claude`, `clinepass`, `cursor`, `opencode`, `opencodego`, `alibaba`, `alibabatokenplan`, `factory`, `gemini`, `antigravity`, `copilot`, `devin`, `zai`, `minimax`, `manus`, `kimi`, `kilo`, `kiro`, `vertexai`, `augment`, `jetbrains`, `moonshot`, `amp`, `t3chat`, `ollama`, `synthetic`, `warp`, `openrouter`, `elevenlabs`, `windsurf`, `zed`, `perplexity`, `mimo`, `doubao`, `sakana`, `abacus`, `mistral`, `deepseek`, `codebuff`, `crof`, `venice`, `commandcode`, `qoder`, `stepfun`, `bedrock`, `grok`, `groq`, `llmproxy`, `litellm`, `deepgram`, `poe`, `chutes`, `neuralwatt`, `clawrouter`, `longcat`, `sub2api`, `wayfinder`, `zenmux`. +`codex`, `openai`, `azureopenai`, `claude`, `clinepass`, `cursor`, `opencode`, `opencodego`, `alibaba`, `alibabatokenplan`, `factory`, `gemini`, `antigravity`, `copilot`, `devin`, `zai`, `minimax`, `manus`, `kimi`, `kilo`, `kiro`, `vertexai`, `augment`, `jetbrains`, `moonshot`, `amp`, `t3chat`, `ollama`, `synthetic`, `warp`, `openrouter`, `elevenlabs`, `windsurf`, `zed`, `perplexity`, `mimo`, `doubao`, `sakana`, `abacus`, `mistral`, `deepseek`, `codebuff`, `crof`, `venice`, `commandcode`, `qoder`, `stepfun`, `bedrock`, `grok`, `groq`, `llmproxy`, `litellm`, `deepgram`, `poe`, `chutes`, `neuralwatt`, `clawrouter`, `longcat`, `sub2api`, `wayfinder`, `zenmux`, `aiand`. ## Ordering The order of `providers` controls display/order in the app and CLI. Reorder the array to change ordering. diff --git a/docs/index.html b/docs/index.html index 5329777a4e..5d17f42f2d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ CodexBar — every AI coding limit, in your menu bar @@ -37,7 +37,7 @@ @@ -293,7 +293,7 @@

- 61 providers,{mobileBreak}one menu bar + 62 providers,{mobileBreak}one menu bar

Popular providers become status items with their own usage windows, reset countdowns, charts, and provider menus. diff --git a/docs/llms.txt b/docs/llms.txt index 0eef651a3f..342ba34c76 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -1,9 +1,9 @@ # CodexBar -A tiny macOS menu bar app that tracks AI coding-provider usage windows, credits, costs, and resets across 61 providers — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, and more. +A tiny macOS menu bar app that tracks AI coding-provider usage windows, credits, costs, and resets across 62 providers — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, and more. Canonical documentation: -- CodexBar — every AI coding limit, in your menu bar: https://codexbar.app/ - A tiny macOS menu bar app that tracks AI coding-provider usage windows, credits, costs, and resets across 61 providers — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, and more. +- CodexBar — every AI coding limit, in your menu bar: https://codexbar.app/ - A tiny macOS menu bar app that tracks AI coding-provider usage windows, credits, costs, and resets across 62 providers — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, and more. Source: https://github.com/steipete/CodexBar diff --git a/docs/providers.md b/docs/providers.md index ac297a2cbd..c7a7c276dc 100644 --- a/docs/providers.md +++ b/docs/providers.md @@ -8,7 +8,7 @@ read_when: # Providers -CodexBar currently registers 61 provider IDs. Some companies expose multiple surfaces, such as Codex vs OpenAI API or +CodexBar currently registers 62 provider IDs. Some companies expose multiple surfaces, such as Codex vs OpenAI API or OpenCode vs OpenCode Go, because the auth source and quota shape differ. ## Fetch strategies (current) diff --git a/docs/site-locales.mjs b/docs/site-locales.mjs index 2da396f75e..53c528f11c 100644 --- a/docs/site-locales.mjs +++ b/docs/site-locales.mjs @@ -98,8 +98,8 @@ export const localeCatalog = [ export const localeMessages = { "en": { "meta.title": "CodexBar — every AI coding limit in your menu bar", - "meta.description": "A tiny macOS menu bar app that tracks AI coding-provider usage windows, credits, costs, and resets across 61 providers — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, and more.", - "meta.ogDescription": "Track usage windows, credits, and resets across 61 AI coding providers from your macOS menu bar.", + "meta.description": "A tiny macOS menu bar app that tracks AI coding-provider usage windows, credits, costs, and resets across 62 providers — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, and more.", + "meta.ogDescription": "Track usage windows, credits, and resets across 62 AI coding providers from your macOS menu bar.", "nav.primary": "Primary", "nav.language": "Language", "nav.docs": "docs", @@ -112,7 +112,7 @@ export const localeMessages = { "hero.description": "CodexBar tracks usage windows, credit balances, and reset countdowns across the providers you actually pay for — one status item each, or merge them into one.", "hero.download": "Download for macOS", "hero.fineprint": "Free & open source · macOS 14+ · Universal via GitHub Releases and Homebrew", - "providers.title": "61 providers,{mobileBreak}one menu bar", + "providers.title": "62 providers,{mobileBreak}one menu bar", "providers.description": "Popular providers become status items with their own usage windows, reset countdowns, charts, and provider menus.", "providers.yourProvider": "Your provider", "providers.authoringGuide": "Authoring guide", @@ -238,8 +238,8 @@ export const localeMessages = { }, "zh-CN": { "meta.title": "CodexBar — 菜单栏中的每个 AI 编码限制", - "meta.description": "一个微小的 macOS 菜单栏应用程序,可跟踪 61 个提供商(Codex、OpenAI、Claude、Cursor、Gemini、Copilot、LiteLLM 等)的 AI 编码提供商使用窗口、积分、成本和重置。", - "meta.ogDescription": "从您的 macOS 菜单栏跟踪 61 个 AI 编码提供商的使用窗口、积分和重置。", + "meta.description": "一个微小的 macOS 菜单栏应用程序,可跟踪 62 个提供商(Codex、OpenAI、Claude、Cursor、Gemini、Copilot、LiteLLM 等)的 AI 编码提供商使用窗口、积分、成本和重置。", + "meta.ogDescription": "从您的 macOS 菜单栏跟踪 62 个 AI 编码提供商的使用窗口、积分和重置。", "nav.primary": "基本的", "nav.language": "语言", "nav.docs": "文档", @@ -252,7 +252,7 @@ export const localeMessages = { "hero.description": "CodexBar 跟踪您实际付费的提供商的使用窗口、信用余额和重置倒计时 - 每个状态项一项,或将它们合并为一项。", "hero.download": "下载macOS", "hero.fineprint": "免费开源 · macOS 14+ · GitHub Releases 和 Homebrew 均提供通用版本", - "providers.title": "61 个提供商,{mobileBreak}一个菜单栏", + "providers.title": "62 个提供商,{mobileBreak}一个菜单栏", "providers.description": "受欢迎的提供商成为状态项目,具有自己的使用窗口、重置倒计时、图表和提供商菜单。", "providers.yourProvider": "您的提供商", "providers.authoringGuide": "创作指南", @@ -378,8 +378,8 @@ export const localeMessages = { }, "zh-TW": { "meta.title": "CodexBar — 功能表列中的每個 AI 編碼限制", - "meta.description": "一個微小的 macOS 功能表列應用程序,可追蹤 61 個提供者(Codex、OpenAI、Claude、Cursor、Gemini、Copilot、LiteLLM 等)的 AI 編碼提供者使用視窗、積分、成本和重設。", - "meta.ogDescription": "從您的 macOS 功能表列追蹤 61 個 AI 編碼提供者的使用視窗、積分和重設。", + "meta.description": "一個微小的 macOS 功能表列應用程序,可追蹤 62 個提供者(Codex、OpenAI、Claude、Cursor、Gemini、Copilot、LiteLLM 等)的 AI 編碼提供者使用視窗、積分、成本和重設。", + "meta.ogDescription": "從您的 macOS 功能表列追蹤 62 個 AI 編碼提供者的使用視窗、積分和重設。", "nav.primary": "基本的", "nav.language": "語言", "nav.docs": "文件", @@ -392,7 +392,7 @@ export const localeMessages = { "hero.description": "CodexBar 追蹤您實際付費的提供者的使用視窗、信用餘額和重設倒數計時 - 每個狀態項一項,或將它們合併為一項。", "hero.download": "下載macOS", "hero.fineprint": "免費開源 · macOS 14+ · GitHub Releases 和 Homebrew 均提供通用版本", - "providers.title": "61 個提供者,{mobileBreak}一個選單列", + "providers.title": "62 個提供者,{mobileBreak}一個選單列", "providers.description": "受歡迎的提供者成為狀態項目,具有自己的使用視窗、重置倒數計時、圖表和提供者選單。", "providers.yourProvider": "您的提供者", "providers.authoringGuide": "創作指南", @@ -518,8 +518,8 @@ export const localeMessages = { }, "ja-JP": { "meta.title": "CodexBar — メニュー バーのすべての AI コーディング制限", - "meta.description": "小さな macOS メニュー バー アプリ。Codex、OpenAI、Claude、Cursor、Gemini、Copilot、LiteLLM など、61 のプロバイダーにわたる AI コーディング プロバイダーの使用期間、クレジット、コスト、リセットを追跡します。", - "meta.ogDescription": "macOS メニュー バーから、61 の AI コーディング プロバイダーにわたる使用期間、クレジット、リセットを追跡します。", + "meta.description": "小さな macOS メニュー バー アプリ。Codex、OpenAI、Claude、Cursor、Gemini、Copilot、LiteLLM など、62 のプロバイダーにわたる AI コーディング プロバイダーの使用期間、クレジット、コスト、リセットを追跡します。", + "meta.ogDescription": "macOS メニュー バーから、62 の AI コーディング プロバイダーにわたる使用期間、クレジット、リセットを追跡します。", "nav.primary": "主要な", "nav.language": "言語", "nav.docs": "ドキュメント", @@ -532,7 +532,7 @@ export const localeMessages = { "hero.description": "CodexBar は、実際に料金を支払っているプロバイダー全体の使用期間、クレジット残高、リセット カウントダウンを追跡します。ステータス項目を 1 つずつ、または 1 つに統合します。", "hero.download": "macOS のダウンロード", "hero.fineprint": "無料・オープンソース · macOS 14+ · GitHub Releases と Homebrew でユニバーサル版を提供", - "providers.title": "61 プロバイダー、{mobileBreak}1つのメニューバー", + "providers.title": "62 プロバイダー、{mobileBreak}1つのメニューバー", "providers.description": "人気のあるプロバイダーは、独自の使用期間、リセット カウントダウン、グラフ、プロバイダー メニューを備えたステータス アイテムになります。", "providers.yourProvider": "あなたのプロバイダー", "providers.authoringGuide": "オーサリングガイド", @@ -658,8 +658,8 @@ export const localeMessages = { }, "es": { "meta.title": "CodexBar: cada límite de codificación de IA en tu barra de menú", - "meta.description": "Una pequeña aplicación de barra de menú macOS que rastrea las ventanas de uso, los créditos, los costos y los restablecimientos de los proveedores de codificación de IA en 61 proveedores: Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM y más.", - "meta.ogDescription": "Realice un seguimiento de las ventanas de uso, los créditos y los restablecimientos en 61 proveedores de codificación de IA desde su barra de menú macOS.", + "meta.description": "Una pequeña aplicación de barra de menú macOS que rastrea las ventanas de uso, los créditos, los costos y los restablecimientos de los proveedores de codificación de IA en 62 proveedores: Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM y más.", + "meta.ogDescription": "Realice un seguimiento de las ventanas de uso, los créditos y los restablecimientos en 62 proveedores de codificación de IA desde su barra de menú macOS.", "nav.primary": "Primario", "nav.language": "Idioma", "nav.docs": "Documentos", @@ -672,7 +672,7 @@ export const localeMessages = { "hero.description": "CodexBar realiza un seguimiento de los períodos de uso, los saldos de crédito y restablece las cuentas regresivas de los proveedores por los que realmente paga: un elemento de estado para cada uno o los fusiona en uno solo.", "hero.download": "Descargar para macOS", "hero.fineprint": "Gratis y de código abierto · macOS 14+ · Universal mediante GitHub Releases y Homebrew", - "providers.title": "61 proveedores,{mobileBreak}una barra de menús", + "providers.title": "62 proveedores,{mobileBreak}una barra de menús", "providers.description": "Los proveedores populares se convierten en elementos de estado con sus propias ventanas de uso, restablecen cuentas regresivas, gráficos y menús de proveedores.", "providers.yourProvider": "Tu proveedor", "providers.authoringGuide": "guía de autoría", @@ -798,8 +798,8 @@ export const localeMessages = { }, "pt-BR": { "meta.title": "CodexBar — todos os limites de codificação de IA na sua barra de menu", - "meta.description": "Um pequeno aplicativo de barra de menu macOS que rastreia janelas de uso, créditos, custos e redefinições do provedor de codificação de IA em 61 provedores — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM e muito mais.", - "meta.ogDescription": "Rastreie janelas de uso, créditos e redefinições em 61 provedores de codificação de IA na barra de menu macOS.", + "meta.description": "Um pequeno aplicativo de barra de menu macOS que rastreia janelas de uso, créditos, custos e redefinições do provedor de codificação de IA em 62 provedores — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM e muito mais.", + "meta.ogDescription": "Rastreie janelas de uso, créditos e redefinições em 62 provedores de codificação de IA na barra de menu macOS.", "nav.primary": "Primário", "nav.language": "Linguagem", "nav.docs": "Documentos", @@ -812,7 +812,7 @@ export const localeMessages = { "hero.description": "CodexBar rastreia janelas de uso, saldos de crédito e reinicia contagens regressivas nos provedores pelos quais você realmente paga - um item de status cada, ou mescla-os em um.", "hero.download": "Baixar para macOS", "hero.fineprint": "Gratuito e de código aberto · macOS 14+ · Universal via GitHub Releases e Homebrew", - "providers.title": "61 provedores,{mobileBreak}uma barra de menu", + "providers.title": "62 provedores,{mobileBreak}uma barra de menu", "providers.description": "Provedores populares tornam-se itens de status com suas próprias janelas de uso, reiniciam contagens regressivas, gráficos e menus de provedores.", "providers.yourProvider": "Seu provedor", "providers.authoringGuide": "Guia de autoria", @@ -938,8 +938,8 @@ export const localeMessages = { }, "ko": { "meta.title": "CodexBar — 메뉴 표시줄의 모든 AI 코딩 제한", - "meta.description": "Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM 등 61개 제공자 전체에서 AI 코딩 제공자 사용 창, 크레딧, 비용 및 재설정을 추적하는 작은 macOS 메뉴 표시줄 앱입니다.", - "meta.ogDescription": "macOS 메뉴 표시줄에서 61개 AI 코딩 제공업체의 사용 기간, 크레딧 및 재설정을 추적하세요.", + "meta.description": "Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM 등 62개 제공자 전체에서 AI 코딩 제공자 사용 창, 크레딧, 비용 및 재설정을 추적하는 작은 macOS 메뉴 표시줄 앱입니다.", + "meta.ogDescription": "macOS 메뉴 표시줄에서 62개 AI 코딩 제공업체의 사용 기간, 크레딧 및 재설정을 추적하세요.", "nav.primary": "주요한", "nav.language": "언어", "nav.docs": "문서", @@ -952,7 +952,7 @@ export const localeMessages = { "hero.description": "CodexBar는 귀하가 실제로 비용을 지불한 제공업체 전반에 걸쳐 사용 기간, 크레딧 잔액 및 재설정 카운트다운을 추적합니다. 즉, 각각 하나의 상태 항목 또는 하나로 병합됩니다.", "hero.download": "macOS 동안 다운로드", "hero.fineprint": "무료 오픈 소스 · macOS 14+ · GitHub Releases와 Homebrew에서 유니버설 제공", - "providers.title": "61개 제공자,{mobileBreak}하나의 메뉴 막대", + "providers.title": "62개 제공자,{mobileBreak}하나의 메뉴 막대", "providers.description": "인기 있는 제공업체는 자체 사용 창, 재설정 카운트다운, 차트 및 제공업체 메뉴를 갖춘 상태 항목이 됩니다.", "providers.yourProvider": "귀하의 제공자", "providers.authoringGuide": "저작 가이드", @@ -1078,8 +1078,8 @@ export const localeMessages = { }, "de": { "meta.title": "CodexBar – alle Limits Ihrer KI-Coding-Tools in der Menüleiste", - "meta.description": "Eine kleine macOS-Menüleisten-App, die Nutzungslimits, Guthaben, Kosten und Resets von 61 KI-Coding-Anbietern im Blick behält – Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM und mehr.", - "meta.ogDescription": "Nutzungslimits, Guthaben und Resets von 61 KI-Coding-Anbietern direkt in Ihrer macOS-Menüleiste.", + "meta.description": "Eine kleine macOS-Menüleisten-App, die Nutzungslimits, Guthaben, Kosten und Resets von 62 KI-Coding-Anbietern im Blick behält – Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM und mehr.", + "meta.ogDescription": "Nutzungslimits, Guthaben und Resets von 62 KI-Coding-Anbietern direkt in Ihrer macOS-Menüleiste.", "nav.primary": "Primär", "nav.language": "Sprache", "nav.docs": "Dokumente", @@ -1092,7 +1092,7 @@ export const localeMessages = { "hero.description": "CodexBar verfolgt Nutzungsfenster, Guthaben und Reset-Countdowns bei den Anbietern, für die Sie tatsächlich bezahlen – jeweils ein Statuselement oder sie werden zu einem zusammengeführt.", "hero.download": "Herunterladen für macOS", "hero.fineprint": "Kostenlos und Open Source · macOS 14+ · Universal über GitHub Releases und Homebrew", - "providers.title": "61 Provider,{mobileBreak}eine Menüleiste", + "providers.title": "62 Provider,{mobileBreak}eine Menüleiste", "providers.description": "Beliebte Anbieter werden zu Statuselementen mit eigenen Nutzungsfenstern, Reset-Countdowns, Diagrammen und Anbietermenüs.", "providers.yourProvider": "Ihr Anbieter", "providers.authoringGuide": "Autorenleitfaden", @@ -1218,8 +1218,8 @@ export const localeMessages = { }, "fr": { "meta.title": "CodexBar — chaque limite de codage IA dans votre barre de menus", - "meta.description": "Une petite application de barre de menus macOS qui suit les fenêtres d'utilisation, les crédits, les coûts et les réinitialisations des fournisseurs de codage d'IA sur 61 fournisseurs : Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, et plus encore.", - "meta.ogDescription": "Suivez les fenêtres d'utilisation, les crédits et les réinitialisations auprès de 61 fournisseurs de codage d'IA à partir de votre barre de menus macOS.", + "meta.description": "Une petite application de barre de menus macOS qui suit les fenêtres d'utilisation, les crédits, les coûts et les réinitialisations des fournisseurs de codage d'IA sur 62 fournisseurs : Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, et plus encore.", + "meta.ogDescription": "Suivez les fenêtres d'utilisation, les crédits et les réinitialisations auprès de 62 fournisseurs de codage d'IA à partir de votre barre de menus macOS.", "nav.primary": "Primaire", "nav.language": "Langue", "nav.docs": "Documents", @@ -1232,7 +1232,7 @@ export const localeMessages = { "hero.description": "CodexBar suit les fenêtres d'utilisation, les soldes créditeurs et réinitialise les comptes à rebours pour les fournisseurs pour lesquels vous payez réellement - un élément de statut chacun, ou les fusionne en un seul.", "hero.download": "Télécharger pour macOS", "hero.fineprint": "Gratuit et open source · macOS 14+ · Universel via GitHub Releases et Homebrew", - "providers.title": "61 fournisseurs,{mobileBreak}une barre des menus", + "providers.title": "62 fournisseurs,{mobileBreak}une barre des menus", "providers.description": "Les fournisseurs populaires deviennent des éléments de statut avec leurs propres fenêtres d'utilisation, réinitialisent les comptes à rebours, les graphiques et les menus des fournisseurs.", "providers.yourProvider": "Votre fournisseur", "providers.authoringGuide": "Guide de création", @@ -1358,8 +1358,8 @@ export const localeMessages = { }, "ar": { "meta.title": "CodexBar — كل حد لترميز الذكاء الاصطناعي في شريط القائمة", - "meta.description": "تطبيق شريط قوائم macOS صغير الحجم يتتبع نوافذ استخدام موفر ترميز الذكاء الاصطناعي، والائتمانات، والتكاليف، وعمليات إعادة التعيين عبر 61 موفرًا - Codex، وOpenAI، وClaude، وCursor، وGemini، وCopilot، وLiteLLM، والمزيد.", - "meta.ogDescription": "تتبع نوافذ الاستخدام والأرصدة وعمليات إعادة التعيين عبر 61 موفرًا لترميز الذكاء الاصطناعي من شريط القائمة macOS.", + "meta.description": "تطبيق شريط قوائم macOS صغير الحجم يتتبع نوافذ استخدام موفر ترميز الذكاء الاصطناعي، والائتمانات، والتكاليف، وعمليات إعادة التعيين عبر 62 موفرًا - Codex، وOpenAI، وClaude، وCursor، وGemini، وCopilot، وLiteLLM، والمزيد.", + "meta.ogDescription": "تتبع نوافذ الاستخدام والأرصدة وعمليات إعادة التعيين عبر 62 موفرًا لترميز الذكاء الاصطناعي من شريط القائمة macOS.", "nav.primary": "أساسي", "nav.language": "لغة", "nav.docs": "المستندات", @@ -1372,7 +1372,7 @@ export const localeMessages = { "hero.description": "يتتبع CodexBar فترات الاستخدام والأرصدة الائتمانية وإعادة تعيين العد التنازلي عبر مقدمي الخدمة الذين تدفع مقابلهم فعليًا — عنصر حالة واحد لكل منهم، أو دمجهم في عنصر واحد.", "hero.download": "التنزيل لمدة macOS", "hero.fineprint": "مجاني ومفتوح المصدر · macOS 14+ · إصدار شامل عبر GitHub Releases وHomebrew", - "providers.title": "61 مزودًا،{mobileBreak}شريط قوائم واحد", + "providers.title": "62 مزودًا،{mobileBreak}شريط قوائم واحد", "providers.description": "يصبح الموفرون المشهورون عناصر حالة مع نوافذ الاستخدام الخاصة بهم، وعمليات إعادة تعيين العد التنازلي، والمخططات، وقوائم الموفر.", "providers.yourProvider": "المزود الخاص بك", "providers.authoringGuide": "دليل التأليف", @@ -1498,8 +1498,8 @@ export const localeMessages = { }, "it": { "meta.title": "CodexBar: ogni limite di codifica AI nella barra dei menu", - "meta.description": "Una piccola app della barra dei menu macOS che tiene traccia delle finestre di utilizzo, dei crediti, dei costi e dei ripristini del fornitore di codifica AI tra 61 fornitori: Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM e altri.", - "meta.ogDescription": "Tieni traccia delle finestre di utilizzo, dei crediti e dei ripristini tra 61 fornitori di codifica AI dalla barra dei menu macOS.", + "meta.description": "Una piccola app della barra dei menu macOS che tiene traccia delle finestre di utilizzo, dei crediti, dei costi e dei ripristini del fornitore di codifica AI tra 62 fornitori: Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM e altri.", + "meta.ogDescription": "Tieni traccia delle finestre di utilizzo, dei crediti e dei ripristini tra 62 fornitori di codifica AI dalla barra dei menu macOS.", "nav.primary": "Primario", "nav.language": "Lingua", "nav.docs": "Documenti", @@ -1512,7 +1512,7 @@ export const localeMessages = { "hero.description": "CodexBar tiene traccia delle finestre di utilizzo, dei saldi del credito e reimposta i conti alla rovescia tra i fornitori per cui paghi effettivamente: un elemento di stato ciascuno o uniscili in uno solo.", "hero.download": "Scarica per macOS", "hero.fineprint": "Gratuito e open source · macOS 14+ · Universale tramite GitHub Releases e Homebrew", - "providers.title": "61 provider,{mobileBreak}una barra dei menu", + "providers.title": "62 provider,{mobileBreak}una barra dei menu", "providers.description": "I fornitori più popolari diventano elementi di stato con le proprie finestre di utilizzo, reimpostano i conti alla rovescia, i grafici e i menu dei fornitori.", "providers.yourProvider": "Il tuo fornitore", "providers.authoringGuide": "Guida all'autore", @@ -1638,8 +1638,8 @@ export const localeMessages = { }, "vi": { "meta.title": "CodexBar — mọi giới hạn mã hóa AI trong thanh menu của bạn", - "meta.description": "Một ứng dụng thanh menu macOS nhỏ theo dõi khoảng thời gian sử dụng, tín dụng, chi phí và đặt lại của nhà cung cấp mã hóa AI trên 61 nhà cung cấp — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, v.v.", - "meta.ogDescription": "Theo dõi khoảng thời gian sử dụng, tín dụng và đặt lại trên 61 nhà cung cấp mã hóa AI từ thanh menu macOS của bạn.", + "meta.description": "Một ứng dụng thanh menu macOS nhỏ theo dõi khoảng thời gian sử dụng, tín dụng, chi phí và đặt lại của nhà cung cấp mã hóa AI trên 62 nhà cung cấp — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, v.v.", + "meta.ogDescription": "Theo dõi khoảng thời gian sử dụng, tín dụng và đặt lại trên 62 nhà cung cấp mã hóa AI từ thanh menu macOS của bạn.", "nav.primary": "Sơ đẳng", "nav.language": "Ngôn ngữ", "nav.docs": "Tài liệu", @@ -1652,7 +1652,7 @@ export const localeMessages = { "hero.description": "CodexBar theo dõi khoảng thời gian sử dụng, số dư tín dụng và đếm ngược đặt lại trên các nhà cung cấp mà bạn thực sự thanh toán — mỗi mục một trạng thái hoặc hợp nhất chúng thành một.", "hero.download": "Tải xuống cho macOS", "hero.fineprint": "Miễn phí và nguồn mở · macOS 14+ · Bản universal qua GitHub Releases và Homebrew", - "providers.title": "61 nhà cung cấp,{mobileBreak}một thanh menu", + "providers.title": "62 nhà cung cấp,{mobileBreak}một thanh menu", "providers.description": "Các nhà cung cấp phổ biến trở thành các mục trạng thái với cửa sổ sử dụng của riêng họ, đặt lại bộ đếm ngược, biểu đồ và menu nhà cung cấp.", "providers.yourProvider": "Nhà cung cấp của bạn", "providers.authoringGuide": "Hướng dẫn soạn thảo", @@ -1778,8 +1778,8 @@ export const localeMessages = { }, "nl": { "meta.title": "CodexBar — elke AI-coderingslimiet in uw menubalk", - "meta.description": "Een kleine macOS menubalk-app die gebruiksperioden, tegoeden, kosten en resets van AI-coderingsproviders bijhoudt bij 61 providers: Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM en meer.", - "meta.ogDescription": "Houd gebruiksvensters, tegoeden en resets bij van 61 leveranciers van AI-codering via uw macOS-menubalk.", + "meta.description": "Een kleine macOS menubalk-app die gebruiksperioden, tegoeden, kosten en resets van AI-coderingsproviders bijhoudt bij 62 providers: Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM en meer.", + "meta.ogDescription": "Houd gebruiksvensters, tegoeden en resets bij van 62 leveranciers van AI-codering via uw macOS-menubalk.", "nav.primary": "Primair", "nav.language": "Taal", "nav.docs": "Documenten", @@ -1792,7 +1792,7 @@ export const localeMessages = { "hero.description": "CodexBar houdt gebruiksperioden, tegoeden en reset-countdowns bij voor de providers waarvoor u daadwerkelijk betaalt: elk één statusitem, of u kunt ze samenvoegen tot één statusitem.", "hero.download": "Downloaden voor macOS", "hero.fineprint": "Gratis en open source · macOS 14+ · Universeel via GitHub Releases en Homebrew", - "providers.title": "61 providers,{mobileBreak}één menubalk", + "providers.title": "62 providers,{mobileBreak}één menubalk", "providers.description": "Populaire providers worden statusitems met hun eigen gebruiksvensters, resetcountdowns, grafieken en providermenu's.", "providers.yourProvider": "Uw aanbieder", "providers.authoringGuide": "Handleiding voor het schrijven", @@ -1918,8 +1918,8 @@ export const localeMessages = { }, "tr": { "meta.title": "CodexBar — menü çubuğunuzdaki tüm AI kodlama limitleri", - "meta.description": "AI kodlama sağlayıcısı kullanım pencerelerini, kredilerini, maliyetlerini izleyen ve Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM ve daha fazlası olmak üzere 61 sağlayıcı genelinde sıfırlamaları izleyen küçük bir macOS menü çubuğu uygulaması.", - "meta.ogDescription": "macOS menü çubuğunu kullanarak 61 AI kodlama sağlayıcısındaki kullanım pencerelerini, kredileri ve sıfırlamaları izleyin.", + "meta.description": "AI kodlama sağlayıcısı kullanım pencerelerini, kredilerini, maliyetlerini izleyen ve Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM ve daha fazlası olmak üzere 62 sağlayıcı genelinde sıfırlamaları izleyen küçük bir macOS menü çubuğu uygulaması.", + "meta.ogDescription": "macOS menü çubuğunu kullanarak 62 AI kodlama sağlayıcısındaki kullanım pencerelerini, kredileri ve sıfırlamaları izleyin.", "nav.primary": "Öncelik", "nav.language": "Dil", "nav.docs": "Dokümanlar", @@ -1932,7 +1932,7 @@ export const localeMessages = { "hero.description": "CodexBar, gerçekte ödeme yaptığınız sağlayıcılar genelinde kullanım pencerelerini, kredi bakiyelerini ve geri sayımları sıfırlar (her biri bir durum öğesi olacak şekilde) izler veya bunları tek bir öğede birleştirir.", "hero.download": "macOS için indirin", "hero.fineprint": "Ücretsiz ve açık kaynak · macOS 14+ · GitHub Releases ve Homebrew ile evrensel sürüm", - "providers.title": "61 sağlayıcı,{mobileBreak}bir menü çubuğu", + "providers.title": "62 sağlayıcı,{mobileBreak}bir menü çubuğu", "providers.description": "Popüler sağlayıcılar, kendi kullanım pencereleri, sıfırlama geri sayımları, çizelgeleri ve sağlayıcı menüleriyle durum öğeleri haline gelir.", "providers.yourProvider": "Sağlayıcınız", "providers.authoringGuide": "Yazma kılavuzu", @@ -2058,8 +2058,8 @@ export const localeMessages = { }, "uk": { "meta.title": "CodexBar — кожне обмеження кодування AI у вашій панелі меню", - "meta.description": "Маленький додаток macOS на панелі меню, який відстежує вікна використання постачальників кодування штучного інтелекту, кредити, витрати та скидання 61 постачальників — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM тощо.", - "meta.ogDescription": "Відстежуйте вікна використання, кредити та скидання 61 постачальників кодування ШІ за допомогою панелі меню macOS.", + "meta.description": "Маленький додаток macOS на панелі меню, який відстежує вікна використання постачальників кодування штучного інтелекту, кредити, витрати та скидання 62 постачальників — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM тощо.", + "meta.ogDescription": "Відстежуйте вікна використання, кредити та скидання 62 постачальників кодування ШІ за допомогою панелі меню macOS.", "nav.primary": "Первинний", "nav.language": "Мова", "nav.docs": "документи", @@ -2072,7 +2072,7 @@ export const localeMessages = { "hero.description": "CodexBar відстежує вікна використання, кредитні баланси та скидає зворотний відлік для постачальників, за яких ви фактично платите, — по одному статусу для кожного або об’єднує їх в один.", "hero.download": "Завантажити для macOS", "hero.fineprint": "Безкоштовний і відкритий код · macOS 14+ · Універсальна версія через GitHub Releases і Homebrew", - "providers.title": "61 провайдерів,{mobileBreak}одна панель меню", + "providers.title": "62 провайдерів,{mobileBreak}одна панель меню", "providers.description": "Популярні постачальники стають елементами статусу з власними вікнами використання, скиданням зворотного відліку, діаграмами та меню постачальників.", "providers.yourProvider": "Ваш провайдер", "providers.authoringGuide": "Авторський посібник", @@ -2198,8 +2198,8 @@ export const localeMessages = { }, "ru": { "meta.title": "CodexBar — все лимиты AI-кодинга в вашей строке меню", - "meta.description": "Небольшое приложение для строки меню macOS, которое отслеживает окна использования, кредиты, расходы и сбросы лимитов у 61 AI-провайдеров для кодинга — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM и других.", - "meta.ogDescription": "Отслеживайте окна использования, кредиты и сбросы лимитов у 61 AI-провайдеров для кодинга прямо из строки меню macOS.", + "meta.description": "Небольшое приложение для строки меню macOS, которое отслеживает окна использования, кредиты, расходы и сбросы лимитов у 62 AI-провайдеров для кодинга — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM и других.", + "meta.ogDescription": "Отслеживайте окна использования, кредиты и сбросы лимитов у 62 AI-провайдеров для кодинга прямо из строки меню macOS.", "nav.primary": "Основная навигация", "nav.language": "Язык", "nav.docs": "Документация", @@ -2212,7 +2212,7 @@ export const localeMessages = { "hero.description": "CodexBar отслеживает окна использования, балансы кредитов и обратный отсчет до сброса у провайдеров, за которых вы действительно платите, — по одному элементу статуса на каждого или все вместе в одном.", "hero.download": "Скачать для macOS", "hero.fineprint": "Бесплатно и с открытым исходным кодом · macOS 14+ · универсальная сборка через GitHub Releases и Homebrew", - "providers.title": "61 провайдеров,{mobileBreak}одна строка меню", + "providers.title": "62 провайдеров,{mobileBreak}одна строка меню", "providers.description": "Популярные провайдеры становятся элементами статуса со своими окнами использования, обратным отсчетом до сброса, графиками и меню провайдера.", "providers.yourProvider": "Ваш провайдер", "providers.authoringGuide": "Руководство по добавлению", @@ -2338,8 +2338,8 @@ export const localeMessages = { }, "id": { "meta.title": "CodexBar — setiap batas pengkodean AI di bilah menu Anda", - "meta.description": "Aplikasi bilah menu macOS kecil yang melacak periode penggunaan, kredit, biaya, dan penyetelan ulang penyedia pengkodean AI di 61 penyedia — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, dan banyak lagi.", - "meta.ogDescription": "Lacak jangka waktu penggunaan, kredit, dan penyetelan ulang di 61 penyedia pengkodean AI dari bilah menu macOS Anda.", + "meta.description": "Aplikasi bilah menu macOS kecil yang melacak periode penggunaan, kredit, biaya, dan penyetelan ulang penyedia pengkodean AI di 62 penyedia — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM, dan banyak lagi.", + "meta.ogDescription": "Lacak jangka waktu penggunaan, kredit, dan penyetelan ulang di 62 penyedia pengkodean AI dari bilah menu macOS Anda.", "nav.primary": "Utama", "nav.language": "Bahasa", "nav.docs": "dokumen", @@ -2352,7 +2352,7 @@ export const localeMessages = { "hero.description": "CodexBar melacak jangka waktu penggunaan, saldo kredit, dan hitungan mundur penyetelan ulang di seluruh penyedia yang sebenarnya Anda bayar — masing-masing satu item status, atau gabungkan menjadi satu.", "hero.download": "Unduh untuk macOS", "hero.fineprint": "Gratis dan sumber terbuka · macOS 14+ · Universal melalui GitHub Releases dan Homebrew", - "providers.title": "61 penyedia,{mobileBreak}satu bilah menu", + "providers.title": "62 penyedia,{mobileBreak}satu bilah menu", "providers.description": "Penyedia populer menjadi item status dengan jendela penggunaannya sendiri, hitung mundur pengaturan ulang, bagan, dan menu penyedia.", "providers.yourProvider": "Penyedia Anda", "providers.authoringGuide": "Panduan penulisan", @@ -2478,8 +2478,8 @@ export const localeMessages = { }, "pl": { "meta.title": "CodexBar — każdy limit kodowania AI na pasku menu", - "meta.description": "Mała aplikacja z paskiem menu macOS, która śledzi okna użycia dostawcy kodowania AI, kredyty, koszty i resety u 61 dostawców — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM i nie tylko.", - "meta.ogDescription": "Śledź okresy użytkowania, kredyty i resety u 61 dostawców kodowania AI za pomocą paska menu macOS.", + "meta.description": "Mała aplikacja z paskiem menu macOS, która śledzi okna użycia dostawcy kodowania AI, kredyty, koszty i resety u 62 dostawców — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM i nie tylko.", + "meta.ogDescription": "Śledź okresy użytkowania, kredyty i resety u 62 dostawców kodowania AI za pomocą paska menu macOS.", "nav.primary": "Podstawowy", "nav.language": "Język", "nav.docs": "Dokumenty", @@ -2492,7 +2492,7 @@ export const localeMessages = { "hero.description": "CodexBar śledzi okna użytkowania, salda kredytów i resetuje odliczanie u dostawców, za których faktycznie płacisz — po jednym statusie dla każdego lub połącz je w jeden.", "hero.download": "Pobierz dla macOS", "hero.fineprint": "Darmowe i otwarte oprogramowanie · macOS 14+ · Wersja uniwersalna przez GitHub Releases i Homebrew", - "providers.title": "61 dostawców,{mobileBreak}jeden pasek menu", + "providers.title": "62 dostawców,{mobileBreak}jeden pasek menu", "providers.description": "Popularni dostawcy stają się elementami statusu z własnymi oknami użytkowania, resetowaniem odliczania, wykresami i menu dostawców.", "providers.yourProvider": "Twój dostawca", "providers.authoringGuide": "Przewodnik autorski", @@ -2618,8 +2618,8 @@ export const localeMessages = { }, "fa": { "meta.title": "CodexBar - هر محدودیت کدنویسی هوش مصنوعی در نوار منو شما", - "meta.description": "یک برنامه نوار منو کوچک macOS که پنجره‌های استفاده از ارائه‌دهنده کدنویسی هوش مصنوعی، اعتبارات، هزینه‌ها، و بازنشانی را در بین 61 ارائه‌دهنده - Codex، OpenAI، Claude، Cursor، Gemini، Copilot، LiteLLM و موارد دیگر بازنشانی می‌کند.", - "meta.ogDescription": "پنجره‌های استفاده، اعتبارات و بازنشانی‌ها را در بین 61 ارائه‌دهنده کدنویسی هوش مصنوعی از نوار منوی macOS خود ردیابی کنید.", + "meta.description": "یک برنامه نوار منو کوچک macOS که پنجره‌های استفاده از ارائه‌دهنده کدنویسی هوش مصنوعی، اعتبارات، هزینه‌ها، و بازنشانی را در بین 62 ارائه‌دهنده - Codex، OpenAI، Claude، Cursor، Gemini، Copilot، LiteLLM و موارد دیگر بازنشانی می‌کند.", + "meta.ogDescription": "پنجره‌های استفاده، اعتبارات و بازنشانی‌ها را در بین 62 ارائه‌دهنده کدنویسی هوش مصنوعی از نوار منوی macOS خود ردیابی کنید.", "nav.primary": "اولیه", "nav.language": "زبان", "nav.docs": "اسناد", @@ -2632,7 +2632,7 @@ export const localeMessages = { "hero.description": "CodexBar پنجره‌های استفاده، مانده اعتبار و بازنشانی شمارش معکوس را در سراسر ارائه‌دهندگانی که واقعاً برایشان پول پرداخت می‌کنید ردیابی می‌کند - هر کدام یک مورد وضعیت، یا آنها را در یکی ادغام کنید.", "hero.download": "دانلود برای macOS", "hero.fineprint": "رایگان و متن‌باز · macOS 14+ · نسخهٔ یونیورسال از GitHub Releases و Homebrew", - "providers.title": "61 ارائه دهنده،{mobileBreak}یک نوار منو", + "providers.title": "62 ارائه دهنده،{mobileBreak}یک نوار منو", "providers.description": "ارائه‌دهندگان محبوب با پنجره‌های استفاده خاص خود، شمارش معکوس، نمودارها و منوهای ارائه‌دهنده را بازنشانی می‌کنند.", "providers.yourProvider": "ارائه دهنده شما", "providers.authoringGuide": "راهنمای نگارش", @@ -2758,8 +2758,8 @@ export const localeMessages = { }, "th": { "meta.title": "CodexBar — ทุกขีดจำกัดการเข้ารหัส AI ในแถบเมนูของคุณ", - "meta.description": "แอปแถบเมนู macOS ขนาดเล็กที่ติดตามกรอบเวลาการใช้งานของผู้ให้บริการเข้ารหัส AI เครดิต ต้นทุน และการรีเซ็ตในผู้ให้บริการ 61 ราย — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM และอีกมากมาย", - "meta.ogDescription": "ติดตามกรอบเวลาการใช้งาน เครดิต และการรีเซ็ตในผู้ให้บริการการเข้ารหัส AI 61 รายจากแถบเมนู macOS", + "meta.description": "แอปแถบเมนู macOS ขนาดเล็กที่ติดตามกรอบเวลาการใช้งานของผู้ให้บริการเข้ารหัส AI เครดิต ต้นทุน และการรีเซ็ตในผู้ให้บริการ 62 ราย — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM และอีกมากมาย", + "meta.ogDescription": "ติดตามกรอบเวลาการใช้งาน เครดิต และการรีเซ็ตในผู้ให้บริการการเข้ารหัส AI 62 รายจากแถบเมนู macOS", "nav.primary": "หลัก", "nav.language": "ภาษา", "nav.docs": "เอกสาร", @@ -2772,7 +2772,7 @@ export const localeMessages = { "hero.description": "CodexBar ติดตามกรอบเวลาการใช้งาน ยอดเครดิต และรีเซ็ตการนับถอยหลังของผู้ให้บริการที่คุณชำระเงินจริง — รายการสถานะแต่ละรายการ หรือรวมรายการเหล่านั้นเป็นรายการเดียว", "hero.download": "ดาวน์โหลดสำหรับ macOS", "hero.fineprint": "ฟรีและโอเพ่นซอร์ส · macOS 14+ · รุ่น Universal ผ่าน GitHub Releases และ Homebrew", - "providers.title": "ผู้ให้บริการ 61 ราย{mobileBreak}หนึ่งแถบเมนู", + "providers.title": "ผู้ให้บริการ 62 ราย{mobileBreak}หนึ่งแถบเมนู", "providers.description": "ผู้ให้บริการยอดนิยมจะกลายเป็นรายการสถานะที่มีหน้าต่างการใช้งานของตนเอง รีเซ็ตการนับถอยหลัง แผนภูมิ และเมนูของผู้ให้บริการ", "providers.yourProvider": "ผู้ให้บริการของคุณ", "providers.authoringGuide": "คู่มือการเขียน", @@ -2898,8 +2898,8 @@ export const localeMessages = { }, "gl": { "meta.title": "CodexBar — todos os límites de programación con IA na túa barra de menús", - "meta.description": "Unha pequena aplicación de barra de menús para macOS que controla as xanelas de uso, os créditos, os custos e os restablecementos de 61 provedores de programación con IA — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM e máis.", - "meta.ogDescription": "Controla as xanelas de uso, os créditos e os restablecementos de 61 provedores de programación con IA desde a barra de menús de macOS.", + "meta.description": "Unha pequena aplicación de barra de menús para macOS que controla as xanelas de uso, os créditos, os custos e os restablecementos de 62 provedores de programación con IA — Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM e máis.", + "meta.ogDescription": "Controla as xanelas de uso, os créditos e os restablecementos de 62 provedores de programación con IA desde a barra de menús de macOS.", "nav.primary": "Principal", "nav.language": "Idioma", "nav.docs": "Documentación", @@ -2912,7 +2912,7 @@ export const localeMessages = { "hero.description": "CodexBar controla as xanelas de uso, os saldos de crédito e as contas atrás ata o restablecemento dos provedores polos que realmente pagas — un elemento de estado para cada un ou todos combinados nun só.", "hero.download": "Descargar para macOS", "hero.fineprint": "Gratuíto e de código aberto · macOS 14+ · Universal mediante GitHub Releases e Homebrew", - "providers.title": "61 provedores,{mobileBreak}unha barra de menús", + "providers.title": "62 provedores,{mobileBreak}unha barra de menús", "providers.description": "Os provedores populares convértense en elementos de estado coas súas propias xanelas de uso, contas atrás de restablecemento, gráficas e menús.", "providers.yourProvider": "O teu provedor", "providers.authoringGuide": "Guía de creación", @@ -3038,8 +3038,8 @@ export const localeMessages = { }, "ca": { "meta.title": "CodexBar: tots els límits de la programació amb IA a la barra de menús", - "meta.description": "Una petita aplicació de barra de menús per a macOS que fa un seguiment de les finestres d'ús, els crèdits, els costos i els restabliments dels proveïdors de programació amb IA: 61 proveïdors, entre els quals Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM i més.", - "meta.ogDescription": "Feu el seguiment de les finestres d'ús, els crèdits i els restabliments de 61 proveïdors de programació amb IA des de la barra de menús del macOS.", + "meta.description": "Una petita aplicació de barra de menús per a macOS que fa un seguiment de les finestres d'ús, els crèdits, els costos i els restabliments dels proveïdors de programació amb IA: 62 proveïdors, entre els quals Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM i més.", + "meta.ogDescription": "Feu el seguiment de les finestres d'ús, els crèdits i els restabliments de 62 proveïdors de programació amb IA des de la barra de menús del macOS.", "nav.primary": "Navegació principal", "nav.language": "Llengua", "nav.docs": "Documentació", @@ -3052,7 +3052,7 @@ export const localeMessages = { "hero.description": "El CodexBar fa el seguiment de les finestres d'ús, els saldos de crèdit i els comptes enrere fins al restabliment dels proveïdors pels quals realment pagueu: un element d'estat per a cadascun, o combineu-los tots en un de sol.", "hero.download": "Baixeu per al macOS", "hero.fineprint": "Gratuït i de codi obert · macOS 14+ · Universal mitjançant GitHub Releases i Homebrew", - "providers.title": "61 proveïdors,{mobileBreak}una barra de menús", + "providers.title": "62 proveïdors,{mobileBreak}una barra de menús", "providers.description": "Els proveïdors populars es converteixen en elements d'estat amb les seves pròpies finestres d'ús, comptes enrere de restabliment, gràfics i menús de proveïdor.", "providers.yourProvider": "El vostre proveïdor", "providers.authoringGuide": "Guia de creació", @@ -3178,8 +3178,8 @@ export const localeMessages = { }, "sv": { "meta.title": "CodexBar — varje AI-kodningsgräns i din menyrad", - "meta.description": "En liten macOS menyradsapp som spårar AI-kodningsleverantörers användningsfönster, krediter, kostnader och återställningar hos 61 leverantörer – Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM och mer.", - "meta.ogDescription": "Spåra användningsfönster, krediter och återställningar hos 61 AI-kodningsleverantörer från din macOS-menyrad.", + "meta.description": "En liten macOS menyradsapp som spårar AI-kodningsleverantörers användningsfönster, krediter, kostnader och återställningar hos 62 leverantörer – Codex, OpenAI, Claude, Cursor, Gemini, Copilot, LiteLLM och mer.", + "meta.ogDescription": "Spåra användningsfönster, krediter och återställningar hos 62 AI-kodningsleverantörer från din macOS-menyrad.", "nav.primary": "Primär", "nav.language": "Språk", "nav.docs": "Dokument", @@ -3192,7 +3192,7 @@ export const localeMessages = { "hero.description": "CodexBar spårar användningsfönster, kreditsaldon och återställningsnedräkningar för de leverantörer du faktiskt betalar för – en statuspost var, eller slå samman dem till en.", "hero.download": "Ladda ner för macOS", "hero.fineprint": "Gratis och öppen källkod · macOS 14+ · Universal via GitHub Releases och Homebrew", - "providers.title": "61 leverantörer,{mobileBreak}en menyrad", + "providers.title": "62 leverantörer,{mobileBreak}en menyrad", "providers.description": "Populära leverantörer blir statusobjekt med sina egna användningsfönster, återställer nedräkningar, diagram och leverantörsmenyer.", "providers.yourProvider": "Din leverantör", "providers.authoringGuide": "Författarguide", diff --git a/docs/social.html b/docs/social.html index eec0aa5876..b08c34d39d 100644 --- a/docs/social.html +++ b/docs/social.html @@ -199,7 +199,7 @@

Every AI coding limit, in your menu bar.

-

61 providers·usage windows, credits, resets·one status item each, or merged.

+

62 providers·usage windows, credits, resets·one status item each, or merged.

    From 55679ceff26607310e04f61b05482ba40cc18304 Mon Sep 17 00:00:00 2001 From: Jetha Chan Date: Fri, 17 Jul 2026 17:55:12 +0900 Subject: [PATCH 2/3] feat: render ai& spend through the shared cost card Route the uncapped ai& cost snapshot through the generic API-spend menu section (spend-only providers with limit 0 are otherwise hidden), register the icon slug in the resource test, and cover the menu card rendering. --- Sources/CodexBar/MenuCardView+Costs.swift | 4 +- Tests/CodexBarTests/AiAndProviderTests.swift | 39 +++++++++++++++++++ .../ProviderIconResourcesTests.swift | 1 + 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Sources/CodexBar/MenuCardView+Costs.swift b/Sources/CodexBar/MenuCardView+Costs.swift index e19406e56f..1fa787c77b 100644 --- a/Sources/CodexBar/MenuCardView+Costs.swift +++ b/Sources/CodexBar/MenuCardView+Costs.swift @@ -349,7 +349,9 @@ extension UsageMenuCardView.Model { percentLine: nil) } - if provider == .openai || provider == .claude || provider == .litellm, cost.limit <= 0 { + if provider == .openai || provider == .claude || provider == .litellm || provider == .aiand, + cost.limit <= 0 + { let spend = UsageFormatter.currencyString(cost.used, currencyCode: cost.currencyCode) let periodLabel = Self.localizedPeriodLabel(cost.period ?? "Last 30 days") return ProviderCostSection( diff --git a/Tests/CodexBarTests/AiAndProviderTests.swift b/Tests/CodexBarTests/AiAndProviderTests.swift index 6232dc6c71..a959e7da22 100644 --- a/Tests/CodexBarTests/AiAndProviderTests.swift +++ b/Tests/CodexBarTests/AiAndProviderTests.swift @@ -260,6 +260,45 @@ struct AiAndProviderTests { #expect(implementation is AiAndProviderImplementation) } + @Test @MainActor + func `menu card renders spend through the generic API-spend path`() async throws { + let now = Date(timeIntervalSince1970: 1_800_000_000) + let transport = ProviderHTTPTransportStub { request in + let url = try #require(request.url) + return Self.response(url: url, body: Self.finalPageFixture) + } + let usage = try await AiAndUsageFetcher.fetchUsage( + "sk-test-fixture", + transport: transport, + now: now) + let model = UsageMenuCardView.Model.make(.init( + provider: .aiand, + metadata: AiAndProviderDescriptor.descriptor.metadata, + snapshot: usage.toUsageSnapshot(), + credits: nil, + creditsError: nil, + dashboard: nil, + dashboardError: nil, + tokenSnapshot: nil, + tokenError: nil, + account: AccountInfo(email: nil, plan: nil), + isRefreshing: false, + lastError: nil, + usageBarsShowUsed: true, + resetTimeDisplayStyle: .countdown, + tokenCostUsageEnabled: false, + showOptionalCreditsAndExtraUsage: true, + hidePersonalInfo: false, + now: now)) + + #expect(model.metrics.isEmpty) + #expect(model.creditsText == nil) + #expect(model.providerCost?.title == "API spend") + #expect(model.providerCost?.spendLine == "Last 30 days: ¥8") + #expect(model.providerCost?.percentUsed == nil) + #expect(model.providerCost?.percentLine == nil) + } + /// Sanitized from a live `/logs` response (2026-07-18); `api_key` arrives pre-masked by the server. private static let finalPageFixture = #""" { diff --git a/Tests/CodexBarTests/ProviderIconResourcesTests.swift b/Tests/CodexBarTests/ProviderIconResourcesTests.swift index bba9a3b2c9..e25548ebbd 100644 --- a/Tests/CodexBarTests/ProviderIconResourcesTests.swift +++ b/Tests/CodexBarTests/ProviderIconResourcesTests.swift @@ -42,6 +42,7 @@ struct ProviderIconResourcesTests { "sub2api", "wayfinder", "zenmux", + "aiand", ] for slug in slugs { let url = resources.appending(path: "ProviderIcon-\(slug).svg") From 4c2d47ece221f3dc46482b22d0870f5dd436006c Mon Sep 17 00:00:00 2001 From: Jetha Chan Date: Fri, 17 Jul 2026 17:56:24 +0900 Subject: [PATCH 3/3] docs: document the ai& provider Add docs/aiand.md, list ai& in the provider table and sections, mention AIAND_API_KEY in configuration docs, and record the change in the changelog. --- CHANGELOG.md | 5 +++ docs/aiand.md | 85 +++++++++++++++++++++++++++++++++++++++++++ docs/configuration.md | 1 + docs/providers.md | 8 ++++ 4 files changed, 99 insertions(+) create mode 100644 docs/aiand.md diff --git a/CHANGELOG.md b/CHANGELOG.md index fd171c1119..037691835a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.44.1 — Unreleased + +### Added +- ai&: add 30-day organization spend summed from the documented request logs API in the org's billing currency, using org-scoped API keys. + ## 0.44.0 — 2026-07-17 ### Added diff --git a/docs/aiand.md b/docs/aiand.md new file mode 100644 index 0000000000..97000f0ce8 --- /dev/null +++ b/docs/aiand.md @@ -0,0 +1,85 @@ +--- +summary: "ai& provider: API key setup and 30-day spend summed from the request logs API." +read_when: + - Configuring ai& usage + - Debugging ai& request-log fetches +--- + +# ai& Provider + +CodexBar reads organization spend from ai&'s documented request-log API. ai& (aiand.com) is an OpenAI/Anthropic-compatible +inference gateway that can back Claude Code, Codex CLI, and opencode (all three have dedicated integration guides in +the ai& docs). + +## Authentication + +Create an API key in the [ai& console](https://console.aiand.com) (Settings → API Keys → Create). Keys use the `sk-` +prefix and are shown once at creation time. Add the key in CodexBar Settings → Providers → ai&. + +You can also set the environment variable: + +```bash +export AIAND_API_KEY="..." +``` + +Or configure it through the CLI: + +```bash +printf '%s' "$AIAND_API_KEY" | codexbar config set-api-key --provider aiand --stdin +``` + +## Data Source + +CodexBar requests: + +- `GET https://api.aiand.com/logs?range=30days&limit=100`, following `next_after`/`next_after_id` cursor pagination + (both cursors are always passed together, as the docs require) for up to 10 pages per refresh. + +Spend is the sum of each log row's `cost` field, parsed as decimal strings — never floating point — in the +organization's billing currency (`currency` per row: USD or JPY). Requests use `Authorization: Bearer `. +CodexBar does not read ai& browser cookies, console sessions, or inference prompts; only per-request cost/currency +metadata from the log rows is used. + +Why the log endpoint: as of 2026-07-18 the documented `cost_usd` field is missing from live +`GET /analytics/summary` responses (the endpoint returns only request/token counts and a token timeseries), and +`/analytics/metrics` has no cost series either. `/logs` matches its documentation exactly and is the only public +endpoint that reports cost, so CodexBar sums spend from it. + +## Display + +The menu shows the last 30 days of organization spend, in the organization's billing currency, as an API-spend row. +ai& bills prepaid credits with no quota windows, so no session or weekly meters are shown. The remaining credit balance +is only available in the ai& console; the public API does not expose it. + +Notes: + +- The billing currency is read from the log rows themselves — CodexBar never assumes a currency. If the organization + made no requests in the window there are no rows and no currency source, so no spend row is shown at all. +- ai& retains request logs for 30 days, which is exactly the summed window. +- CodexBar reads at most 10 pages (1,000 requests) per refresh. If the organization has more requests in the window, + the row is labeled "Last 30 days (partial)" and covers only the newest 1,000 requests — there is no silent + truncation. +- If log rows ever disagree on currency, only rows matching the newest row's currency are summed. +- ai& caches analytics responses server-side for 120 seconds, so the number can lag up to two minutes. +- API keys are organization-scoped: every key in the same organization reports the same org-wide spend. + +## CLI Usage + +```bash +codexbar usage --provider aiand +``` + +`ai&` and `ai-and` also work as provider aliases. + +## Troubleshooting + +- A `401` means ai& rejected the API key; create a new key in the console (keys are shown only once). +- A `402` means the organization is out of prepaid credits; top up at console.aiand.com. +- A `429` means the per-minute rate limit was hit; CodexBar retries on the next refresh cycle. +- A "(partial)" period label means the 10-page cap was hit; the total covers the newest 1,000 requests only. + +## Sources + +- [Request Logs](https://docs.aiand.com/analytics/logs/) +- [Authentication](https://docs.aiand.com/authentication/) +- [Credits & Top-Up](https://docs.aiand.com/billing/credits/) diff --git a/docs/configuration.md b/docs/configuration.md index 78adee2fc0..2ce799a93f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -178,6 +178,7 @@ printf '%s' "$LLM_PROXY_API_KEY" | codexbar config set-api-key --provider llmpro printf '%s' "$LITELLM_API_KEY" | codexbar config set-api-key --provider litellm --stdin printf '%s' "$CLAWROUTER_API_KEY" | codexbar config set-api-key --provider clawrouter --stdin printf '%s' "$SUB2API_API_KEY" | codexbar config set-api-key --provider sub2api --stdin +printf '%s' "$AIAND_API_KEY" | codexbar config set-api-key --provider aiand --stdin ``` OpenAI API project scoping uses `workspaceID` in config. This maps to `OPENAI_PROJECT_ID` for Admin API usage and is diff --git a/docs/providers.md b/docs/providers.md index c7a7c276dc..ddcb48f4fb 100644 --- a/docs/providers.md +++ b/docs/providers.md @@ -90,6 +90,7 @@ scan fails, while provider/account configuration changes replace obsolete result | Chutes | API key from config/env → subscription usage and quota API (`api`). | | Neuralwatt | API key from config/env → `/v1/quota` subscription kWh usage and prepaid balance (`api`). | | ZenMux | Management API key from config/env → five-hour and seven-day quota windows plus PAYG balance (`api`). | +| ai& | API key from config/env → 30-day organization spend summed from the request logs API (`api`). | | Zed | Zed editor Keychain session → `cloud.zed.dev/client/users/me` for plan and quota data (`local`). | ## Codex @@ -521,4 +522,11 @@ scan fails, while provider/account configuration changes replace obsolete result - Status: none yet. - Details: `docs/stepfun.md`. +## ai& +- API key from config or `AIAND_API_KEY` (org-scoped `sk-` key from console.aiand.com). +- Sums the last 30 days of organization spend from `GET https://api.aiand.com/logs` (per-request `cost` in the org's billing currency, USD or JPY, read from the rows — never assumed), following `next_after`/`next_after_id` cursor pagination up to 10 pages. An empty window shows no spend row. +- The live `/analytics/summary` endpoint carries no cost field despite its docs, so the request log is the spend source; a hit page cap is labeled "Last 30 days (partial)" instead of silently truncating. +- Prepaid credits with no quota windows; no session or weekly meters are synthesized. The credit balance is console-only and not shown. +- Details: `docs/aiand.md`. + See also: `docs/provider.md` for architecture notes.