Closed richardchui closed 2 months ago
Hey @richardchui,
OpenRouter doesn't allow the OpenAI-Beta
header in its CORS configuration. The OpenAIClient
sets this header by default to enable the assistants API which is still in beta. You can remove this header by settings beta: null
:
final client = OpenAIClient(
apiKey: Platform.environment['OPEN_ROUTER_API_KEY'],
baseUrl: 'https://openrouter.ai/api/v1',
beta: null,
);
Problem sovled. Cannot thank you enough for this.
Using openrouter will encounter a CORS issue. No problem with other services such as TogetherAI and Groq.
Have tried using openrouter with another dart package (dart_openai) and everything works fine.