r/opencode • u/Apprehensive-Ad-1333 • 25m ago
Using the opencode API key for Chat Only UI
I have been working on a minimal frontend-only Chat interface for AI (https://github.com/prastavna/aiui).
I was hoping to use the opencode API key for inference. But I am blocked by CORS. Wanted to know if it's possible?
Error:
Access to fetch at 'https://opencode.ai/inference/go/openai/v1/chat/completions' from origin '<redacted> has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
2
Upvotes
1
u/Wise-Bother9942 17m ago
Dude, did you put a Header, like a browser header with your app name etc.
They changed it awhile ago to require full App headers to be sent when using Opencode, if you don't have one it'll just get auto-rejected.