motif64

Chat · CPU/API

published by @dh7 on

m64 m64_ed4181ee0b62
Download .tar.gz

Hello world: a capsule that serves its own documentation. No model, no GPU, no network: a chat endpoint that greets you back, its docs for people at /human/ and for agents at /agent. Start here.

Lineage

parent
none declared
derived from
m64_07e5f7d772c8, 83% shared files

Files

6 files

AGENT.md

hello-world

A minimal m64 capsule: an OpenAI-compatible chat endpoint that answers Hello, world! You said: <your last message>. No model, no GPU, no network. It exists to show what every capsule looks like from the outside.

Base URL: {{BASE_URL}}

Routes

Method Path Served by What
POST /v1/chat/completions the capsule the greeting, streaming or not
GET /v1/models the capsule one model: hello-world
GET /status m64 phase (ready when usable)
GET /agent m64 this document, with the base URL filled in
GET /human/ m64 a page for people, with a form to try it

Any other path is a 404: m64's front only lets a chat capsule's routes through.

POST /v1/chat/completions

curl -s {{BASE_URL}}/v1/chat/completions {{AUTH}} \
  -H 'Content-Type: application/json' \
  -d '{"messages":[{"role":"user","content":"hi there"}]}'

Accepted fields: messages (required), tools, tool_choice, response_format, max_tokens, stream, seed. Anything else, like temperature, is refused by m64 with a 400 that names the field. model is rewritten to hello-world whatever you send.

"stream": true returns server-sent events, one word per chunk, ending with data: [DONE].

GET /status

curl -s {{BASE_URL}}/status {{AUTH}}

Timings and limits

  • Ready about a second after start.
  • Every answer is instant. Requests are handled in parallel.
  • Errors: 400 for a body without a messages list, 404 for an unknown path.

capsule.toml

# hello-world: the smallest useful capsule. No model, no GPU, no network.## Every capsule is a folder with three required files:#   capsule.toml  this manifest: what the capsule is and what it needs#   start.sh      the entrypoint the container runs#   AGENT.md      the document an agent reads; m64 serves it at /agent# and usually a human/ folder, which m64 serves at /human/.## The folder's id (m64_...) is the hash of its files, so any edit, even to a# comment, gives a new id. Run `m64 hash examples/hello-world` to see it.schema = "m64/capsule@1"# The first sentence is what lists show (cut at 60 characters).description = "Hello world: a capsule that serves its own documentation. No model, no GPU, no network: a chat endpoint that greets you back, its docs for people at /human/ and for agents at /agent. Start here."# The kind decides which routes m64's front lets through: chat = POST# /v1/chat/completions and GET /v1/models. Every other path is a 404, except the# ones the front serves itself (/status, /agent, /human/).kinds = ["chat"]authors = ["motif42"]license = "mit"[hardware]# Must equal what `m64 doctor` prints on the machine that serves it; another# platform is refused. On an ARM machine (GB10, Apple-silicon Linux VM...) change# this to "linux-aarch64": the image below is multi-arch, nothing else changes.platform = "linux-x86_64"# No gpu line: this capsule runs on CPU.[runtime]sandbox = "container"# Always pinned by digest, never a bare tag. This is python:3.12-slim (multi-arch# index digest). server.py uses the standard library only, so no Dockerfile.image = "python@sha256:2f17fc044b579bab302c2e8054d3a686e2cb9a83de48e70534b94cd8ebbe06a9"gpu = false# The server inside listens on this port; m64 passes it as $M64_PORT.internal_port = 9000# m64 waits for a 200 here before calling the capsule ready.health = "/health"expected_load_seconds = 5# The front rewrites every request's "model" to this name.model_name = "hello-world"# Never root inside the container: nobody:nogroup.user = "65534:65534"