mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Introduce runtime-configurable payload mutation/filter rules with file reload support and a settings API so upstream request bodies can be customized per model and protocol without restarts. Expand search support with Google PSE, Linkup, SearchAPI, and SearXNG, including validation, routing, analytics costing, MCP schema updates, and search-type-aware provider selection. Update Pollinations to support anonymous access, endpoint failover, and the latest public model lineup. Add OmniRoute response metadata headers/SSE comments, per-connection model exclusion rules, combo tag-based routing, buffered spend writes, and scheduled daily/weekly/monthly budget resets. Update model catalog and dashboard UIs to surface source labels and hide models excluded by all active connections.
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { BaseExecutor } from "./base.ts";
|
|
import { PROVIDERS } from "../config/constants.ts";
|
|
|
|
/**
|
|
* PollinationsExecutor — OpenAI-compatible Pollinations text endpoint.
|
|
*
|
|
* Pollinations currently exposes a public endpoint and an optional key-backed tier.
|
|
* OmniRoute sends the bearer token when configured, but no auth header is required
|
|
* for the anonymous endpoint.
|
|
*
|
|
* Endpoint: https://text.pollinations.ai/openai/chat/completions
|
|
* Docs: https://pollinations.ai/docs
|
|
*/
|
|
export class PollinationsExecutor extends BaseExecutor {
|
|
constructor() {
|
|
super("pollinations", PROVIDERS["pollinations"] || { format: "openai" });
|
|
}
|
|
|
|
buildUrl(_model: string, _stream: boolean, urlIndex = 0, _credentials = null): string {
|
|
const baseUrls = this.getBaseUrls();
|
|
return (
|
|
baseUrls[urlIndex] || baseUrls[0] || "https://text.pollinations.ai/openai/chat/completions"
|
|
);
|
|
}
|
|
|
|
buildHeaders(credentials: any, stream = true): Record<string, string> {
|
|
const key = credentials?.apiKey || credentials?.accessToken;
|
|
|
|
const headers: Record<string, string> = {
|
|
"Content-Type": "application/json",
|
|
};
|
|
|
|
if (key) {
|
|
headers.Authorization = `Bearer ${key}`;
|
|
}
|
|
|
|
if (stream) {
|
|
headers["Accept"] = "text/event-stream";
|
|
}
|
|
|
|
return headers;
|
|
}
|
|
|
|
transformRequest(model: string, body: any, _stream: boolean, _credentials: any): any {
|
|
// Pollinations uses provider aliases directly: "openai", "claude", "gemini", etc.
|
|
return body;
|
|
}
|
|
}
|
|
|
|
export default PollinationsExecutor;
|