How to use co/core and connect with bluesky
... first steps with co/core
o/core is a distributed AI solution. You can lend your Silicon Mac/macbook spaces although you do not have to, and you can use the AI tool to run your queries on their models. However, as these models run on your own computer, it is not as easy as opening a chat box on chatgpt and work with it. You need to understand a few things and spend some time setting it up. But once you set up the tools, you have a very robust and perfectly usable AI application where you can run your queries without incurring the high costs of running expensive models. In this post I will describe step by step setting up your workflow with co/core using Opencode, but you will see that for the full functionality, you do not really need opencode. If you have a linux or Mac, that is enough as long as you are comfortable running node or more specifically npm on it.
Step 1. Go here: https://cocore.dev/start and get an API key. You will need your _atproto username (e.g. @foo.bsky.social) and your password to enter the system
Step 2. Set up your query.ts file. You do not really need opencode to run co/core, cocore is just an OpenAI-compatible API endpoint (https://cocore.dev/api/v1). You can call it directly with curl or from any tool/client that supports OpenAI-compatible APIs — a raw Python script, Postman, other CLI agents, etc. You don't need OpenCode at all. You can get a sample query.ts file from cocore.dev that looks like as follows:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://cocore.dev/v1",
apiKey: "cocore-...",
});
const stream = await client.chat.completions.create({
model: "stub",
messages: [{ role: "user", content: "Hello" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Step 3. Now make some changes. Remember that the stub only allows you to connect to co/core, you will need to change the stub with an actual model. You can get a list of models from https://cocore.dev/models. When you start, you get a million tokens to work with. I am still getting my head around how the tokens work, see more here: https://cocore.dev/blog/hello-world
Step 4. Just run the content. And contribute your computing to the project (I know this is optional, but a mark of good citizenship)
Did you enjoy this article?
Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.