Use OpenCode free model
OpenCode offers free hosted models that do not require a paid subscription.
ts
import { configure, connect } from "switchboard-ai-sdk";
configure({
opencodeModel: "opencode/deepseek-v4-flash-free"
});
const tool = await connect("opencode");
const auth = await tool.checkAuth();
if (auth.authStatus === "unauthenticated") {
const start = await tool.startAuth();
console.log("Run:", start.command);
console.log(start.instructions);
process.exit(0);
}
const result = await tool.chat({
messages: [
{ role: "user", content: "Write a bash script that lists the 10 largest files in a directory." }
],
});
console.log(result.message.content);Other free models
opencode/big-pickleopencode/mimo-v2.5-freeopencode/nemotron-3-ultra-freeopencode/north-mini-code-free