Skip to content
OxyHQPublic

About

Oxy inference data plane: provider adapters, routing execution, streaming, deployments, health and technical metering. Control plane is OxyHQ/oxy.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Kaana

Kaana

Kaana is Oxy's inference platform. One API executes requests across many upstream providers and models, the same idea as OpenRouter, operated by Oxy for Oxy's own products and for external customers. Its one canonical origin is https://kaana.ai.

This repository is the Go data plane (kaana, its publisher and its operator tools) plus the TypeScript workspace that defines the wire contract and the SDK:

Workspace What it is
cmd/, internal/ the Go data plane, deployed to ECS
packages/contracts @kaana.ai/contracts, the Zod source of every request, response and signed shape
packages/sdk @kaana.ai/sdk, the TypeScript client
tools/contract generates internal/contract/descriptor.json and packages/contracts/openapi.json
configs/ the declared catalogue, deployment commercial facts, rate cards, model attribution

Gemies owns the agent runtime, including the Alia gemie. Conversations, tools, memory and approvals remain there.

How a request reaches a provider

Kaana has two ways in, sharing one executor, one inventory and one key store. The full split is in docs/lanes.md.

customer / SDK / Claude Code -> https://kaana.ai/v1 -> Oxy grant -> Kaana routes, executes, settles
Oxy edge / first-party service -> /internal/v1/inference (signed) -> Kaana executes the signed order
  • On the public lane Kaana asks Oxy for a signed grant, resolves it into ordered routes (key funding tier, the grant's line order, the caller's provider preferences, cache affinity, recent latency), executes with failover, and writes one settlement per grant.
  • On the signed lane Oxy signs an ordered list of exact deploymentId values and Kaana attempts exactly that order.
  • On both, Kaana picks the key: a deployment runs on its provider's pool, cheapest stated funding first, inside the ceiling the grant or envelope carries (docs/key-pools.md). It retries the same route on transient failures and fails over before the first output, never after.
  • A request that names an exact model revision is served on exactly that revision or refused. It is never quietly answered by a different model.

New to Oxy inference? The concepts (exact model, power level, app default) and the product-side request paths are in the Oxy inference developer guide.

Ownership and migration status

The owner accepted ADR 0010: Kaana owns inference policy, spend authorization, accounting and invoices; Oxy supplies identity only. The request paths above describe the existing execution lanes, whose Oxy grants remain authoritative during migration.

Kaana Oxy
inference API, catalogue, power levels, provider selection and execution accounts, organizations, applications, credentials and verified person/workload identity
capacity, routing/economic policy, pricing, holds, ledger, receipts and invoices under the accepted migration existing financial grants and records only for their original legacy operations until drained
encrypted provider keys, BYOK custody, technical usage and upstream cost Console identity/key management and product interfaces that may consume Kaana's financial API

The identity contract is source-implemented; native admission and commercial billing have separate delivery gates. No balance transfer, seller setup or production native enrollment follows from this README. ADR 0010 records the verified current backend principal, absent Kaana merchant, implementation inventory and authority-preserving cutover sequence.

Upstream keys never live in environment variables, the repository or product databases. Customer BYOK remains ungrantable until its reviewed fee schedule and gates exist (customer-provider-credentials).

Quick start

go build ./...
make check          # every CI gate, in CI's order
make help           # every target; make tools reports missing local tools

make check is the definition of done. make test-integration also needs a local PostgreSQL in KAANA_POSTGRES_TEST_URL.

Configuration

Every KAANA_* variable, what it is for and how a failure looks is in docs/operating.md. The ones a process cannot start without:

Setting Meaning
KAANA_INVENTORY_PATH the deployment inventory snapshot (mounted by the publisher's output, never baked into the image; see docs/inventory.md)
KAANA_EDGE_PUBLIC_KEYS kid:base64,... Ed25519 public keys the Oxy edge signs with; not secret
KAANA_PROVIDERS the provider slugs this process serves
DATABASE_URL TLS PostgreSQL connection to Kaana's database
KAANA_PROVIDER_CREDENTIALS_KMS_KEY_ARN the symmetric KMS key that encrypts provider credentials; not secret
AWS workload identity how Kaana authenticates to Oxy; there is no service-key fallback (Oxy identity)
KAANA_PUBLIC_API_ENABLED serves https://kaana.ai/v1; off, a merge is not an exposure

Which providers are built in, how to declare another one, and the rollout gates for a new provider are in docs/provider-onboarding.md and docs/adapters.md. A built-in adapter never invents a model list.

Layout

cmd/kaana/                              the serving process: both lanes, settlement worker, reloads
cmd/kaana-publisher/                    discovers models and re-issues the inventory on a cadence
cmd/kaana-credentials/                  one-shot admin: migrate and administer encrypted provider keys
cmd/kaana-credential-control/           signed customer-BYOK create/rotate/revoke task
cmd/kaana-platform-credential-control/  signed platform-pool import/rotate task
cmd/kaana-platform-credential-import/   operator-host client; signed HTTPS, secret on stdin
cmd/kaana-probe/                        liveness probe used by the canary
cmd/kaana-eval/                         latency benchmark through the public API
internal/publicapi/                     the public lane: grants, routes, preferences, settlement, catalogue
internal/httpapi/                       the signed lane
internal/kaana/                         the executor: routing, failover, retries, framing, usage
internal/realtime/                      realtime sessions, resume across tasks
internal/provider/                      the Adapter interface, key pools, error vocabulary, adapters
internal/inventory/                     which deployment serves which model, and staleness
internal/publisher/                     discovery, zero-retention checks, withholding, S3 output
internal/rotation/                      per-deployment breakers and latency / throughput readings
internal/credentialstore/               PostgreSQL: ciphertext, key state, outbox, cost events, KMS
internal/providercost/                  upstream provider cost and rate cards
internal/contract/                      Go types for the @kaana.ai/contracts wire
internal/edgeauth/                      Ed25519 verification of signed Oxy requests
packages/contracts/  packages/sdk/      the wire contract and the client
configs/                                public-catalogue.json, deployment-commercial.json, provider-rates.json,
                                        model-attribution.json, inventory.json (a reference snapshot for tests)

Documentation

Start with docs/lanes.md, then the topic you are changing. Each topic document ends with the rules a reviewer applies; AGENTS.md is the index.

Topic Documents
Shape of the system lanes, architecture, findings log, identity-and-routing, inference-rules, rules
Routing and execution routing, key-pools, determinism
Inventory and publication inventory, operating
Contract and API contract, contract history, anthropic-messages, json-repair, decisions
Providers adapters, provider-onboarding, dated reviews, openai-audio, elevenlabs, deepgram, realtime, realtime findings
Keys and money customer-provider-credentials, cost, ADR 0010
Decisions docs/adr/
Records of one-off rollouts schema-0013-cutover, provider-credential-id-cutover, first-party-producer, first-party-transport, platform-activity, groq-token-capacity, scoped-attempt-claims

Tracked as workstream 13 of OxyHQ/oxy#972.

About

Oxy inference data plane: provider adapters, routing execution, streaming, deployments, health and technical metering. Control plane is OxyHQ/oxy.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages