Skip to main content

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.

Metadata

Release files for otari-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for otari-cli 0.1.0
File Size Uploaded Provenance
otari_cli-0.1.0.tar.gz 28.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for otari-cli 0.1.0
File Interpreter ABI Platform
otari_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 59.0 kB

Release files / otari_cli-0.1.0.tar.gz

Download URL otari_cli-0.1.0.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cdc31592ffcbf52e9b76b5b3fc66098861cfa64cd4b28ff5ca85846cc8c72f4c
BLAKE2b-256 checksum
How to use checksums
791fa443c4ff01a8c9554a9faa492875197f241076900c26a3dc8c3fb4cb78b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / otari_cli-0.1.0-py3-none-any.whl

Download URL otari_cli-0.1.0-py3-none-any.whl
Size 31.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3114b72387db1d50197ffae70bb84a4f41888e812d80369e407bf7256db10486
BLAKE2b-256 checksum
How to use checksums
cc1b684a5e6d74e9587b9ce8b80b7a37278d27dd145909f819bdd1319b5ad8cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Security for otari-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for otari_cli-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page