Is your feature request related to a problem? Please describe.
Currently API Calls are routed through the flask backend. Anthropic has kind of silently introduced the "anthropic-dangerous-direct-browser-access" header to allow cors calls from everywhere
Describe the solution you'd like
Harmonize the calls to providers. For anthropic it could now be like
// Make a REST call to Anthropic
// Repeat call n times, waiting for each response to come in:
const responses: Array<Dict> = [];
while (responses.length < n) {
// Abort if canceled
if (should_cancel && should_cancel()) throw new UserForcedPrematureExit();
// Direct API call to Anthropic (harmonized with other providers)
const url = `https://api.anthropic.com/v1/${
use_messages_api ? "messages" : "complete"
}`;
const headers = {
"x-api-key": ANTHROPIC_API_KEY,
"anthropic-version": "2023-06-01",
"content-type": "application/json",
"anthropic-dangerous-direct-browser-access": "true", // Enable direct browser access
};
[...]
Additional context
See this Issue for details.
Is your feature request related to a problem? Please describe.
Currently API Calls are routed through the flask backend. Anthropic has kind of silently introduced the "anthropic-dangerous-direct-browser-access" header to allow cors calls from everywhere
Describe the solution you'd like
Harmonize the calls to providers. For anthropic it could now be like
Additional context
See this Issue for details.