Skip to main content

OpenRouter API CLI tool

Project description

orter

Typer-based CLI tool that uses OpenRouter API.

Installation

uvx orter

Usage

Environment Variable Setup

You can set the OPENROUTER_API_KEY environment variable, or use the --api-key option with each command.

Models

List available models.

# Default output: human-readable table + default limit(20)
uv run orter models
uv run orter models list --limit 20

# Search
uv run orter models --search gpt-4o --limit 20

# Output in JSON format
uv run orter models --json

# Get specific model information
uv run orter models get openai/gpt-4o-mini

Chat Completions

Send chat completion requests.

# Basic usage (recommended)
uv run orter chat completions -m "Hello"

# Specify model
uv run orter chat completions -m "Print Hello World in Python" --model "openai/gpt-4o"

# Enable streaming
uv run orter chat completions -m "Write a simple story" --stream

# Include system message
uv run orter chat completions -m "User message" --system "You are a helpful AI assistant."

# Output in JSON format
uv run orter chat completions -m "Hello" --json

# Using additional parameters
uv run orter chat completions -m "Write a creative story" \
  --temperature 0.9 \
  --max-tokens 500 \
  --model "openai/gpt-4o-mini"

Generation

Query generation statistics.

# Get generation statistics (using id from chat completions response)
uv run orter generation get gen-xxxxxxxxxxxxxx

# Output in JSON format
uv run orter generation get gen-xxxxxxxxxxxxxx --json

Raw (full API access)

uv run orter raw request GET api/v1/models
uv run orter raw request POST api/v1/chat/completions \
  --body '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'

Key Features

  • Chat Completions API support
  • Streaming support
  • Models API support
  • Generation statistics lookup
  • Call any endpoint with raw (full API access)
  • JSON output option
  • Type safety guarantee

Examples

Simple Question

uv run orter chat completions -m "What are the advantages of Python?"

Code Generation

uv run orter chat completions -m "Create a simple calculator function in Python" \
  --model "openai/gpt-4o-mini" \
  --temperature 0.7

Streaming Response

uv run orter chat completions -m "Write a long story" --stream

License

MIT

Documentation References

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

orter-0.1.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

orter-0.1.0-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: orter-0.1.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for orter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8bcf331527f972e84968e84d1eb52f73a25dc89d58e3eeae9fde84a1b5f4844f
MD5 24f8a5b34893f1fa3890096aa8aafb7e
BLAKE2b-256 1eb048cfe792630fbc6dd23cbd3bea3f8c8cd316805c800c3dae00b89ca4f3ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: orter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for orter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 626d580a4dc0ceba86ae467253ea003852624448f52452b4484409988db9faf5
MD5 6feb99709705d6c2eb0bffcde72d2e3f
BLAKE2b-256 ef1280b6d8817123112ef9121d570c5902d243cb3e0ab72a66caf43303e77b6f

See more details on using hashes here.

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