crater-openai

crater-openai

OpenAI-to-ActivityPub/ForgeFed translator. ActivityPub plumbing (actor documents, inbox/outbox, HTTP signatures, WebFinger, NodeInfo, delivery) is provided by aptok; this gateway is the OpenAI-side adapter that translates /v1/chat/completions and /v1/responses into Create{Ticket} activities and back.

Endpoints

OpenAI:

  • POST /v1/chat/completions
  • POST /v1/responses
  • GET /v1/models — preset aliases (auto, smallest, lowprice, balanced, fastest, highest, longcontext, local) plus discovered followers (<model>-<provider>).
  • GET /v1/models/:id
  • GET /health

ActivityPub (served by the embedded Aptok::Federation):

  • GET /actor/:identifier — Service actor for a preset or follower
  • POST /actor/:identifier/inbox — per-actor inbox (Create / Update / …)
  • GET /actor/:identifier/outbox
  • POST /inbox — shared inbox
  • GET /.well-known/webfinger
  • GET /.well-known/nodeinfo, GET /nodeinfo/2.1

Config

The runtime config lives in crater-openai.config.rcl (RCL). Per-provider ForgeFed inbox/actor/target are set on each provider "..." block; the ENV variables below are cross-cutting knobs.

Local actor key (used to sign outbound POSTs)

The gateway signs delivery via aptok's ActorKeyPair. aptok will not derive a public key from the private one — both must be provided.

  • CRATER_LOCAL_KEY_IDkeyId URI written into the Signature header, e.g. https://crapi.example.com/actor/auto#main-key
  • CRATER_LOCAL_ACTOR — owner URI of the key
  • CRATER_LOCAL_PRIVATE_KEY_PEMpath to the private key PEM file
  • CRATER_LOCAL_PRIVATE_KEY_INLINE_PEM — inline PEM (alternative to the file path, useful with Docker / k8s secrets)
  • CRATER_LOCAL_PUBLIC_KEY_PEM — inline PEM of the public key
  • CRATER_LOCAL_PUBLIC_KEY_PATHpath to the public key PEM file (alternative to inline)
  • CRATER_LOCAL_KEY_ALGORITHMrsa-sha256 (default) or ed25519

Signing is disabled silently when any of keyId / actor / one of the key sources is missing.

Public origin (used when minting actor URIs)

  • CRATER_PUBLIC_BASE_URL — authoritative override, e.g. https://crapi.example.com. When absent, the gateway falls back to X-Forwarded-Host + X-Forwarded-Proto, then the request Host.

Legacy per-request ForgeFed delivery (deprecated)

These are kept for callers that haven't moved to RCL providers yet. They're still accepted but provide no signing or queue behavior:

  • CRATER_FORGEFED_INBOX / X-Forgefed-Inbox
  • CRATER_FORGEFED_ACTOR / X-Forgefed-Actor
  • CRATER_FORGEFED_TARGET / X-Forgefed-Target

Run

cd crater-openai
shards install
crystal run src/main.cr

OpenCode setup

Use opencode.json as a provider template for local usage. Default URL targets this service at http://127.0.0.1:3000/v1.

Repository

crater-openai

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 4
  • 1 day ago
  • March 7, 2026
License

Links
Synced at

Thu, 11 Jun 2026 08:45:22 GMT

Languages