feat(settings): add Nous Portal provider (#175)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Settings gains hermes' `nous` slug as a fourth provider on every surface and the Provider Keys page — endpoint https://inference-api.nousresearch.com/v1, NOUS_API_KEY, the 5-level OpenAI-compatible effort ladder, switch flagship anthropic/claude-sonnet-5 (live-probed: the portal's docs-listed Hermes-4 ids 404 — the inference API serves the OpenRouter catalog, so the switch keeps the app's sonnet posture billed through Nous). The probe speaks plain OpenAI chat-completions; an unkeyed test borrows the shared Portal session's agent_key (the engine's own credential — hermes' nous runtime is OAuth-only, and a portal key and subscription bill the same account credits), gated to the official https endpoint so the implicit credential never rides a user-edited URL. Pass readiness rides the same fallback, so a logged-in machine runs passes with no key. Suite 635. Closes #175
This commit is contained in:
1 parent
d305f822aa
commit
b2db859887
15 files changed
+410
-30
No files matched your search
@@ -56,6 +56,27 @@ struct ProviderProbeTransportTests {
|
||||
#expect(request.url?.absoluteString == "\(ZaiKeyType.coding.endpoint)/chat/completions")
|
||||
}
|
||||
|
||||
/// #175: Nous Portal is plain OpenAI chat-completions on the wire —
|
||||
/// live-probed 2026-11-05 (messages body answers finish=stop; the
|
||||
/// portal router has no z.ai-style thinking knobs) — Bearer auth like
|
||||
/// z.ai/openai, `/chat/completions` + `/models` on the versioned base.
|
||||
@Test func `nous chat speaks the plain chat completions dialect`() throws {
|
||||
let config = ProviderProbe.Config(
|
||||
provider: .nous, endpoint: ModelProvider.nous.defaultEndpoint, apiKey: "sk-nous", model: "anthropic/claude-sonnet-5",
|
||||
)
|
||||
let request = try #require(ProviderProbe.makeChatRequest(config))
|
||||
#expect(request.value(forHTTPHeaderField: "Authorization") == "Bearer sk-nous")
|
||||
#expect(request.url?.absoluteString == "https://inference-api.nousresearch.com/v1/chat/completions")
|
||||
#expect(ProviderProbe.modelsURL(for: .nous, endpoint: ModelProvider.nous.defaultEndpoint)?
|
||||
.absoluteString == "https://inference-api.nousresearch.com/v1/models")
|
||||
let bodyData = try #require(request.httpBody)
|
||||
let body = try #require(String(bytes: bodyData, encoding: .utf8))
|
||||
#expect(body.contains(#""messages""#))
|
||||
#expect(body.contains(#""max_tokens":\#(ProviderProbe.probeTokenCap)"#))
|
||||
#expect(!body.contains("thinking")) // no z.ai reasoning knobs on the portal router
|
||||
#expect(!body.contains("reasoning_effort"))
|
||||
}
|
||||
|
||||
@Test func `openai chat speaks the responses api and urls append cleanly`() throws {
|
||||
let config = ProviderProbe.Config(
|
||||
provider: .openaiAPI, endpoint: "https://api.openai.com/v1/", apiKey: "sk-oai", model: "gpt-6.1-sol",
|
||||
|
||||
Reference in new issue
Block a user