Skip to main content

Command-line interface for the otari LLM gateway and platform

Project description

otari-cli

Python 3.11+ License: Apache 2.0 CI

Command-line interface for otari, the OpenAI-compatible LLM gateway you own and run yourself.

otari gateway | Python SDK | Documentation

otari-cli is a thin command-line wrapper over the otari Python client SDK. It talks to a self-hosted otari gateway or the hosted platform at otari.ai.

Installation

Requirements

  • Python 3.11 or newer

Install

pip install otari-cli

This installs the otari console command.

Authentication

otari-cli reads the same environment variables as the otari SDK, so it works in two modes. Flags always override the environment.

Variable Mode Purpose
OTARI_AI_TOKEN Platform Bearer token; base URL defaults to https://api.otari.ai.
GATEWAY_API_BASE Self-hosted Gateway base URL (required for self-hosted).
GATEWAY_API_KEY Self-hosted Virtual API key (sent via the Otari-Key header).
GATEWAY_ADMIN_KEY Either Admin key for control-plane commands (keys, usage).

Equivalent flags: --token, --api-base, --api-key, --admin-key.

Usage

# Show help and the available commands
otari --help

# Check that the configured gateway is reachable
otari --api-base http://localhost:8000 health

# List the models the gateway can route to
otari models

# Create a chat completion
otari completion -m openai:gpt-4o-mini "Write a haiku about gateways."

# Stream the response token by token
otari completion -m openai:gpt-4o-mini --stream "Tell me a short story."

# Emit machine-readable JSON instead of formatted output
otari --json models

Generation commands

otari completion -m openai:gpt-4o-mini "Hello"        # chat completions (+ --stream)
otari message -m anthropic:claude-3-5-sonnet "Hello"  # Anthropic-style messages (+ --stream)
otari response -m openai:gpt-4o-mini "Hello"          # Responses API (+ --stream)
otari embedding -m openai:text-embedding-3-small "a sentence"
otari moderation -m openai:omni-moderation-latest "some text"
otari rerank -m cohere:rerank-v3.5 -q "query" "doc one" "doc two"
otari models
otari batches create -m openai:gpt-4o-mini --input requests.jsonl
otari batches list --provider openai
otari batches results <batch-id> --provider openai

The --json and --stream flags compose: with both set, streaming commands emit one JSON event object per chunk (newline-delimited) rather than a single document.

Control-plane commands (self-hosted / admin)

These require an admin credential and a self-hosted gateway:

# Keys
otari keys list
otari keys create --name prod --user u_123 --metadata '{"team": "ml"}'
otari keys update <key-id> --inactive
otari keys delete <key-id>

# Users, budgets, pricing
otari users create u_123 --alias "ML team" --budget b_1
otari budgets create --max-budget 100 --duration-sec 86400
otari pricing set openai:gpt-4o-mini --input-price 0.15 --output-price 0.60

# Usage
otari usage list --user u_123 --start 2026-01-01 --end 2026-01-31
otari users usage u_123

Development

otari-cli uses uv.

uv sync --extra dev      # install with dev dependencies
uv run otari --help      # run the CLI from source
uv run ruff check .      # lint
uv run mypy src/         # type check (strict)
uv run pytest            # tests

See CONTRIBUTING.md and AGENTS.md for the full workflow and conventions.

Commands

Group Commands
Generation completion, message, response (each with --stream), embedding, moderation, rerank, models
Batches batches create, batches retrieve, batches list, batches cancel, batches results
Control plane keys, users, budgets, pricing (CRUD), usage list, users usage
Diagnostics health

Run otari <command> --help for the full options of any command.

License

otari-cli is licensed under the Apache License 2.0. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otari_cli-0.1.0.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otari_cli-0.1.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file otari_cli-0.1.0.tar.gz.

File metadata

  • Download URL: otari_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for otari_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cdc31592ffcbf52e9b76b5b3fc66098861cfa64cd4b28ff5ca85846cc8c72f4c
MD5 98c1e27c0509f33640402aedb0a4f3b4
BLAKE2b-256 791fa443c4ff01a8c9554a9faa492875197f241076900c26a3dc8c3fb4cb78b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for otari_cli-0.1.0.tar.gz:

Publisher: publish.yml on mozilla-ai/otari-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file otari_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: otari_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for otari_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3114b72387db1d50197ffae70bb84a4f41888e812d80369e407bf7256db10486
MD5 fd29445423c8fe17e71b4f8daef777aa
BLAKE2b-256 cc1b684a5e6d74e9587b9ce8b80b7a37278d27dd145909f819bdd1319b5ad8cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for otari_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on mozilla-ai/otari-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page