Skip to content

API and opencode

The gateway speaks the OpenAI chat-completions API at https://api.aisathome.org/v1. Any client that lets you set a base URL and a key works: opencode, the OpenAI SDKs, curl.

Sign in with GitHub or Google on your account page and create a key there (up to three). A key is shown once; copy it then. Keys are personal and share your account’s daily limit with the chat. If a key leaks, revoke it on the same page.

Name What
deep Qwen3.8 27B, general chat
agent The same model, for coding agents and tool calls
qwen3.8-27b Qwen3.8 27B as UD-IQ4_XS (about 4 bits), on 24 GB cards, 192k context
qwen3.8-27b-q3 Qwen3.8 27B as UD-Q3_K_XL (about 3 bits), on 16 GB cards, 80k context; scores a little lower (model settings)

GET /v1/models lists what the network serves right now. deep and agent go to either file; the answer’s model field names the one that answered. A conversation stays on the file it started on: once it has an answer, its later requests go only to nodes running that file, and if none is online the request fails with a message saying so (try again later, or start a new conversation) rather than switching files midway. Ask for qwen3.8-27b or qwen3.8-27b-q3 to choose a file yourself.

Terminal window
export AISATHOME_API_KEY=ak-...
curl https://api.aisathome.org/v1/chat/completions \
-H "Authorization: Bearer $AISATHOME_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"deep","messages":[{"role":"user","content":"What is BOINC?"}]}'

Add a provider to ~/.config/opencode/opencode.json:

{
"$schema": "https://opencode.ai/config.json",
"permission": {
"bash": "ask",
"edit": "ask",
"external_directory": "ask",
"webfetch": "ask",
"websearch": "ask",
"read": {
"*.env": "deny",
"*.env.*": "deny",
"*.netrc": "deny",
"*.git-credentials": "deny",
"~/.ssh/*": "deny",
"~/.aws/*": "deny",
"~/.config/*": "deny"
}
},
"provider": {
"aisathome": {
"npm": "@ai-sdk/openai-compatible",
"name": "AIs@home",
"options": {
"baseURL": "https://api.aisathome.org/v1",
"apiKey": "{env:AISATHOME_API_KEY}"
},
"models": {
"agent": {
"name": "AIs@home agent (Qwen3.8 27B)",
"limit": { "context": 81920, "output": 8192 }
}
}
}
}
}

Set context to the context_length that /v1/models reports for agent (the context every node serving it can take: 81920 while a 16 GB node serves it, 196608 while only 24 GB nodes do):

Terminal window
curl -s https://api.aisathome.org/v1/models -H "Authorization: Bearer $AISATHOME_API_KEY"

Then export AISATHOME_API_KEY=ak-... and run opencode -m aisathome/agent. Tool calls (reading and editing files, running commands) work. "permission" makes opencode ask before each command, file edit, web fetch or search and any access outside the project, and never read .env files or the credential files listed: keep it (see below), and never run the agent with --auto. This is the format of opencode 1.x; opencode2 takes the same rules as a "permissions" list (permissions).

  • Secrets: a safety net, not a guarantee. A simple scan tries to replace well-known key formats with a placeholder like sk-proj-AISX…XXXX before a node sees them, and does not put them back into the answer or into tool calls, so a file the agent writes may contain the placeholder instead of your real key. Unusual formats get through: treat the service as untrusted and keep secrets out of what the agent can read.
  • Who serves you. Chats and plain API requests may be answered by any volunteer’s node. Anything that looks like personal data goes only to your own node; without one online, the request is refused with HTTP 400 and "code": "personal_data". Requests with tools (agents) go to volunteers’ nodes when the key allows it: Run requests through nodes operated by other people is ticked by default when you create a key. If you untick it, agent requests go only to your own node.
  • Answers are not checked for safety. Nothing stops a harmful command in an answer from a volunteer’s node: the gateway logs commands that look dangerous, but passes them on, because it cannot tell an honest model reading a credential file from an attack. A model can propose a harmful command with any provider, and a malicious node could write one. So approve every command yourself (opencode’s "permission" above; never auto-approve), and preferably run the agent isolated: in a dedicated Docker container or virtual machine with only the project mounted, no SSH keys, cloud credentials or browser profile, and nothing you could not afford to lose.
  • Context and answer length. A request must fit the context of a node that serves it: the prompt (everything sent, including tool definitions and earlier turns) plus the room for the answer. /v1/models reports context_length, the context every node serving the model can take right now. A request larger than any node can take fails at once with 400 context_length_exceeded, naming the largest available. Answers are capped at 32,768 tokens; without max_tokens, at 16,384.
  • Thinking. The model thinks before it answers. reasoning_effort set to "medium" or "low" asks for less thinking than the default. Nodes stop thinking after 8,192 tokens per answer and make the model answer. A request can set its own limit with thinking_budget_tokens (0 to 32,768; reasoning_budget_tokens is the same setting), and with reasoning_budget_message, the text the model is given at that point (plain text, at most 512 bytes, no <), for example "\n\nI have thought enough. I will act now.\n". Other values are refused with 400.
  • Limits: a daily token budget, requests per minute and concurrent requests per key. Over the limit you get 429 with a Retry-After header. Answers from your own nodes don’t count against the daily budget, and once it is used up your requests still go to your own nodes.