otari-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ """``otari usage`` - inspect gateway usage logs (control plane).
2
+
3
+ Requires an admin credential and a self-hosted/standalone gateway.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing import TYPE_CHECKING
9
+
10
+ import typer
11
+
12
+ from otari_cli import _client
13
+ from otari_cli._errors import handle_errors
14
+ from otari_cli._output import render_records
15
+ from otari_cli._params import parse_datetime
16
+
17
+ if TYPE_CHECKING:
18
+ from otari_cli._context import AppContext
19
+
20
+ app = typer.Typer(
21
+ name="usage",
22
+ help="Inspect gateway usage logs (admin / self-hosted only).",
23
+ no_args_is_help=True,
24
+ )
25
+
26
+
27
+ @app.command("list")
28
+ def list_usage(
29
+ ctx: typer.Context,
30
+ user_id: str | None = typer.Option(None, "--user", help="Filter by user id."),
31
+ start: str | None = typer.Option(None, "--start", help="Start date (ISO-8601), inclusive."),
32
+ end: str | None = typer.Option(None, "--end", help="End date (ISO-8601), inclusive."),
33
+ skip: int | None = typer.Option(None, "--skip", help="Number of entries to skip."),
34
+ limit: int | None = typer.Option(None, "--limit", help="Maximum number of entries to return."),
35
+ ) -> None:
36
+ """List usage-log entries."""
37
+ app_ctx: AppContext = ctx.obj
38
+ start_date = parse_datetime(start, flag="--start")
39
+ end_date = parse_datetime(end, flag="--end")
40
+ with handle_errors(), _client.session(app_ctx.config) as client:
41
+ result = client.control_plane.usage.list(
42
+ start_date=start_date,
43
+ end_date=end_date,
44
+ user_id=user_id,
45
+ skip=skip,
46
+ limit=limit,
47
+ )
48
+ render_records(
49
+ list(result),
50
+ output_json=app_ctx.output_json,
51
+ title="Usage",
52
+ empty_message="No usage entries found.",
53
+ )
@@ -0,0 +1,131 @@
1
+ """``otari users`` - manage gateway users (control plane).
2
+
3
+ Requires an admin credential and a self-hosted/standalone gateway.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing import TYPE_CHECKING
9
+
10
+ import typer
11
+ from otari._client import CreateUserRequest, UpdateUserRequest
12
+
13
+ from otari_cli import _client
14
+ from otari_cli._errors import handle_errors
15
+ from otari_cli._output import console, print_json, render_records
16
+ from otari_cli._params import drop_none, parse_json_object
17
+
18
+ if TYPE_CHECKING:
19
+ from otari_cli._context import AppContext
20
+
21
+ app = typer.Typer(
22
+ name="users",
23
+ help="Manage gateway users (admin / self-hosted only).",
24
+ no_args_is_help=True,
25
+ )
26
+
27
+
28
+ @app.command("list")
29
+ def list_users(
30
+ ctx: typer.Context,
31
+ skip: int | None = typer.Option(None, "--skip", help="Number of users to skip."),
32
+ limit: int | None = typer.Option(None, "--limit", help="Maximum number of users to return."),
33
+ ) -> None:
34
+ """List users."""
35
+ app_ctx: AppContext = ctx.obj
36
+ with handle_errors(), _client.session(app_ctx.config) as client:
37
+ result = client.control_plane.users.list(skip=skip, limit=limit)
38
+ render_records(list(result), output_json=app_ctx.output_json, title="Users", empty_message="No users found.")
39
+
40
+
41
+ @app.command("get")
42
+ def get_user(
43
+ ctx: typer.Context,
44
+ user_id: str = typer.Argument(..., help="Identifier of the user."),
45
+ ) -> None:
46
+ """Show details for a single user."""
47
+ app_ctx: AppContext = ctx.obj
48
+ with handle_errors(), _client.session(app_ctx.config) as client:
49
+ result = client.control_plane.users.get(user_id)
50
+ print_json(result)
51
+
52
+
53
+ @app.command("create")
54
+ def create_user(
55
+ ctx: typer.Context,
56
+ user_id: str = typer.Argument(..., help="Unique user identifier."),
57
+ alias: str | None = typer.Option(None, "--alias", help="Admin-facing alias."),
58
+ budget_id: str | None = typer.Option(None, "--budget", help="Budget id to associate."),
59
+ blocked: bool = typer.Option(False, "--blocked/--unblocked", help="Whether the user is blocked."),
60
+ metadata: str | None = typer.Option(None, "--metadata", help="Metadata as a JSON object."),
61
+ ) -> None:
62
+ """Create a user."""
63
+ app_ctx: AppContext = ctx.obj
64
+ request = CreateUserRequest(
65
+ user_id=user_id,
66
+ blocked=blocked,
67
+ **drop_none(
68
+ alias=alias,
69
+ budget_id=budget_id,
70
+ metadata=parse_json_object(metadata, flag="--metadata"),
71
+ ),
72
+ )
73
+ with handle_errors(), _client.session(app_ctx.config) as client:
74
+ result = client.control_plane.users.create(request)
75
+ print_json(result)
76
+
77
+
78
+ @app.command("update")
79
+ def update_user(
80
+ ctx: typer.Context,
81
+ user_id: str = typer.Argument(..., help="Identifier of the user to update."),
82
+ alias: str | None = typer.Option(None, "--alias", help="New admin-facing alias."),
83
+ budget_id: str | None = typer.Option(None, "--budget", help="New budget id."),
84
+ blocked: bool | None = typer.Option(None, "--blocked/--unblocked", help="Block or unblock the user."),
85
+ metadata: str | None = typer.Option(None, "--metadata", help="Metadata as a JSON object."),
86
+ ) -> None:
87
+ """Update a user. Only the provided fields are changed."""
88
+ app_ctx: AppContext = ctx.obj
89
+ request = UpdateUserRequest(
90
+ **drop_none(
91
+ alias=alias,
92
+ budget_id=budget_id,
93
+ blocked=blocked,
94
+ metadata=parse_json_object(metadata, flag="--metadata"),
95
+ )
96
+ )
97
+ with handle_errors(), _client.session(app_ctx.config) as client:
98
+ result = client.control_plane.users.update(user_id, request)
99
+ print_json(result)
100
+
101
+
102
+ @app.command("delete")
103
+ def delete_user(
104
+ ctx: typer.Context,
105
+ user_id: str = typer.Argument(..., help="Identifier of the user to delete."),
106
+ yes: bool = typer.Option(False, "--yes", "-y", help="Skip the confirmation prompt."),
107
+ ) -> None:
108
+ """Delete a user."""
109
+ app_ctx: AppContext = ctx.obj
110
+ if not yes:
111
+ typer.confirm(f"Delete user {user_id!r}?", abort=True)
112
+ with handle_errors(), _client.session(app_ctx.config) as client:
113
+ client.control_plane.users.delete(user_id)
114
+ console().print(f"[bold green]Deleted[/] user {user_id!r}.")
115
+
116
+
117
+ @app.command("usage")
118
+ def user_usage(
119
+ ctx: typer.Context,
120
+ user_id: str = typer.Argument(..., help="Identifier of the user."),
121
+ ) -> None:
122
+ """Show usage-log entries for a single user."""
123
+ app_ctx: AppContext = ctx.obj
124
+ with handle_errors(), _client.session(app_ctx.config) as client:
125
+ result = client.control_plane.users.get_usage(user_id)
126
+ render_records(
127
+ list(result),
128
+ output_json=app_ctx.output_json,
129
+ title=f"Usage for {user_id}",
130
+ empty_message="No usage entries found.",
131
+ )
otari_cli/config.py ADDED
@@ -0,0 +1,62 @@
1
+ """Resolution of otari connection settings from CLI flags and environment.
2
+
3
+ The resolution mirrors the :mod:`otari` SDK so the CLI honors the same
4
+ environment variables and the same platform/self-hosted auth modes:
5
+
6
+ - Platform mode: ``OTARI_AI_TOKEN`` (legacy alias ``GATEWAY_PLATFORM_TOKEN``)
7
+ is sent as a Bearer token; ``api_base`` defaults to the hosted gateway.
8
+ - Self-hosted mode: ``GATEWAY_API_KEY`` is sent via the ``Otari-Key`` header and
9
+ ``GATEWAY_API_BASE`` must point at the gateway.
10
+ - Control-plane (management) calls need an admin credential: ``GATEWAY_ADMIN_KEY``
11
+ or, in platform mode, the platform token.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import os
17
+ from dataclasses import dataclass
18
+
19
+ PLATFORM_DEFAULT_BASE = "https://api.otari.ai"
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class OtariConfig:
24
+ """Resolved connection settings passed to :class:`otari.OtariClient`."""
25
+
26
+ api_base: str | None
27
+ api_key: str | None
28
+ platform_token: str | None
29
+ admin_key: str | None
30
+
31
+ @property
32
+ def is_platform(self) -> bool:
33
+ """Whether the resolved credentials select platform (hosted) mode."""
34
+ return self.platform_token is not None and self.api_key is None
35
+
36
+ @classmethod
37
+ def resolve(
38
+ cls,
39
+ *,
40
+ api_base: str | None = None,
41
+ api_key: str | None = None,
42
+ token: str | None = None,
43
+ admin_key: str | None = None,
44
+ ) -> OtariConfig:
45
+ """Resolve config from explicit flags, falling back to environment variables.
46
+
47
+ Explicit arguments win over environment variables. In platform mode
48
+ (a token with no API key), ``api_base`` defaults to
49
+ :data:`PLATFORM_DEFAULT_BASE` when nothing else is set.
50
+ """
51
+ platform_token = token or os.getenv("OTARI_AI_TOKEN") or os.getenv("GATEWAY_PLATFORM_TOKEN")
52
+ resolved_api_key = api_key or os.getenv("GATEWAY_API_KEY")
53
+ resolved_base = api_base or os.getenv("GATEWAY_API_BASE")
54
+ if resolved_base is None and platform_token is not None and resolved_api_key is None:
55
+ resolved_base = PLATFORM_DEFAULT_BASE
56
+ resolved_admin = admin_key or os.getenv("GATEWAY_ADMIN_KEY") or platform_token
57
+ return cls(
58
+ api_base=resolved_base,
59
+ api_key=resolved_api_key,
60
+ platform_token=platform_token,
61
+ admin_key=resolved_admin,
62
+ )
otari_cli/py.typed ADDED
File without changes
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: otari-cli
3
+ Version: 0.1.0
4
+ Summary: Command-line interface for the otari LLM gateway and platform
5
+ Project-URL: Homepage, https://github.com/mozilla-ai/otari-cli
6
+ Project-URL: Documentation, https://mozilla-ai.github.io/otari/
7
+ Project-URL: Repository, https://github.com/mozilla-ai/otari-cli
8
+ Project-URL: Issues, https://github.com/mozilla-ai/otari-cli/issues
9
+ Author-email: Mozilla AI <ai-engineering@mozilla.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: httpx>=0.25.0
24
+ Requires-Dist: otari>=0.1.0
25
+ Requires-Dist: rich>=13.0
26
+ Requires-Dist: typer>=0.12
27
+ Provides-Extra: dev
28
+ Requires-Dist: mypy>=1.13; extra == 'dev'
29
+ Requires-Dist: pytest>=8.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.8; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ <div align="center">
34
+
35
+ # otari-cli
36
+
37
+ ![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)
38
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
39
+ [![CI](https://github.com/mozilla-ai/otari-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/mozilla-ai/otari-cli/actions/workflows/ci.yml)
40
+
41
+ **Command-line interface for [otari](https://github.com/mozilla-ai/otari), the OpenAI-compatible LLM gateway you own and run yourself.**
42
+
43
+ [otari gateway](https://github.com/mozilla-ai/otari) | [Python SDK](https://github.com/mozilla-ai/otari-sdk-python) | [Documentation](https://mozilla-ai.github.io/otari/)
44
+
45
+ </div>
46
+
47
+ > otari-cli is a thin command-line wrapper over the [`otari`](https://pypi.org/project/otari/) Python client SDK. It talks to a self-hosted otari gateway or the hosted platform at [otari.ai](https://otari.ai).
48
+
49
+ ## Installation
50
+
51
+ ### Requirements
52
+
53
+ - Python 3.11 or newer
54
+
55
+ ### Install
56
+
57
+ ```bash
58
+ pip install otari-cli
59
+ ```
60
+
61
+ This installs the `otari` console command.
62
+
63
+ ## Authentication
64
+
65
+ otari-cli reads the same environment variables as the otari SDK, so it works in
66
+ two modes. Flags always override the environment.
67
+
68
+ | Variable | Mode | Purpose |
69
+ | --- | --- | --- |
70
+ | `OTARI_AI_TOKEN` | Platform | Bearer token; base URL defaults to `https://api.otari.ai`. |
71
+ | `GATEWAY_API_BASE` | Self-hosted | Gateway base URL (required for self-hosted). |
72
+ | `GATEWAY_API_KEY` | Self-hosted | Virtual API key (sent via the `Otari-Key` header). |
73
+ | `GATEWAY_ADMIN_KEY` | Either | Admin key for control-plane commands (`keys`, `usage`). |
74
+
75
+ Equivalent flags: `--token`, `--api-base`, `--api-key`, `--admin-key`.
76
+
77
+ ## Usage
78
+
79
+ ```bash
80
+ # Show help and the available commands
81
+ otari --help
82
+
83
+ # Check that the configured gateway is reachable
84
+ otari --api-base http://localhost:8000 health
85
+
86
+ # List the models the gateway can route to
87
+ otari models
88
+
89
+ # Create a chat completion
90
+ otari completion -m openai:gpt-4o-mini "Write a haiku about gateways."
91
+
92
+ # Stream the response token by token
93
+ otari completion -m openai:gpt-4o-mini --stream "Tell me a short story."
94
+
95
+ # Emit machine-readable JSON instead of formatted output
96
+ otari --json models
97
+ ```
98
+
99
+ ### Generation commands
100
+
101
+ ```bash
102
+ otari completion -m openai:gpt-4o-mini "Hello" # chat completions (+ --stream)
103
+ otari message -m anthropic:claude-3-5-sonnet "Hello" # Anthropic-style messages (+ --stream)
104
+ otari response -m openai:gpt-4o-mini "Hello" # Responses API (+ --stream)
105
+ otari embedding -m openai:text-embedding-3-small "a sentence"
106
+ otari moderation -m openai:omni-moderation-latest "some text"
107
+ otari rerank -m cohere:rerank-v3.5 -q "query" "doc one" "doc two"
108
+ otari models
109
+ otari batches create -m openai:gpt-4o-mini --input requests.jsonl
110
+ otari batches list --provider openai
111
+ otari batches results <batch-id> --provider openai
112
+ ```
113
+
114
+ The `--json` and `--stream` flags compose: with both set, streaming commands emit
115
+ one JSON event object per chunk (newline-delimited) rather than a single document.
116
+
117
+ ### Control-plane commands (self-hosted / admin)
118
+
119
+ These require an admin credential and a self-hosted gateway:
120
+
121
+ ```bash
122
+ # Keys
123
+ otari keys list
124
+ otari keys create --name prod --user u_123 --metadata '{"team": "ml"}'
125
+ otari keys update <key-id> --inactive
126
+ otari keys delete <key-id>
127
+
128
+ # Users, budgets, pricing
129
+ otari users create u_123 --alias "ML team" --budget b_1
130
+ otari budgets create --max-budget 100 --duration-sec 86400
131
+ otari pricing set openai:gpt-4o-mini --input-price 0.15 --output-price 0.60
132
+
133
+ # Usage
134
+ otari usage list --user u_123 --start 2026-01-01 --end 2026-01-31
135
+ otari users usage u_123
136
+ ```
137
+
138
+ ## Development
139
+
140
+ otari-cli uses [`uv`](https://docs.astral.sh/uv/).
141
+
142
+ ```bash
143
+ uv sync --extra dev # install with dev dependencies
144
+ uv run otari --help # run the CLI from source
145
+ uv run ruff check . # lint
146
+ uv run mypy src/ # type check (strict)
147
+ uv run pytest # tests
148
+ ```
149
+
150
+ See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md) for the full
151
+ workflow and conventions.
152
+
153
+ ## Commands
154
+
155
+ | Group | Commands |
156
+ | --- | --- |
157
+ | Generation | `completion`, `message`, `response` (each with `--stream`), `embedding`, `moderation`, `rerank`, `models` |
158
+ | Batches | `batches create`, `batches retrieve`, `batches list`, `batches cancel`, `batches results` |
159
+ | Control plane | `keys`, `users`, `budgets`, `pricing` (CRUD), `usage list`, `users usage` |
160
+ | Diagnostics | `health` |
161
+
162
+ Run `otari <command> --help` for the full options of any command.
163
+
164
+ ## License
165
+
166
+ otari-cli is licensed under the Apache License 2.0. See the [LICENSE](LICENSE)
167
+ file for details.
@@ -0,0 +1,30 @@
1
+ otari_cli/__init__.py,sha256=c5R1Uw8QEMBeEikNZGUDVqmGGa0AT_-eHkSsGeVAgRM,566
2
+ otari_cli/__main__.py,sha256=tPpv4C4Z4y77jrIhNDtGwScyzLBYVpkqmeffvpiTSj8,154
3
+ otari_cli/_client.py,sha256=lo13196FKSQptv3ZiKPfXzbZh6II0jDtXZ5op1wnr-c,1287
4
+ otari_cli/_context.py,sha256=gXN1PaAxA3F7UhcnpNgxVpIiNHjnZlJQ1L35lO2c16g,392
5
+ otari_cli/_errors.py,sha256=Nu89dZnjav0ABdpQgMeEgoKMwY1AVU_QK79w28_6uAY,1998
6
+ otari_cli/_output.py,sha256=QayM-JvhWg5HyRBo4ZgRWzFdDLX333drPBWbBchSWZw,2716
7
+ otari_cli/_params.py,sha256=rPPHPrAe7cVdCb8t2p0Dt5GLzKgyxjRdaItd_TgNVfk,1607
8
+ otari_cli/cli.py,sha256=n2kcXn4KFeogmKFkb0PauFsAW7BZTr-YbshIg54xNQ8,2770
9
+ otari_cli/config.py,sha256=g0gNZNXVhOWNSzj8V7M2JOph9R8RBwEPFCtQ-ptdTdI,2363
10
+ otari_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ otari_cli/commands/__init__.py,sha256=uHmnfL6praF-74ywxVw0jHSBo1IGy7ehg3JnfwgBWNo,215
12
+ otari_cli/commands/batches.py,sha256=Gc-xtidjM3XjCjtGdbjGLYfV5T5owOP1mnXNLeSUbUo,5885
13
+ otari_cli/commands/budgets.py,sha256=dNBnc_1CGZJdjrcawqj_tDRkGNprpegFNTuhxDVO2QY,3593
14
+ otari_cli/commands/completion.py,sha256=qrsRSpXUK4SIysfrjaVnfmurSRUyiG6589jJbItUXYc,2849
15
+ otari_cli/commands/embedding.py,sha256=M0WWDK7eHYyjr3zFwb2f8LV10XuFclNG_4bT9Slf-D4,1712
16
+ otari_cli/commands/health.py,sha256=VBSR8-bPAqJMmid5FBRcoVXm0V8ncQFfmqqwvYPJaj8,1579
17
+ otari_cli/commands/keys.py,sha256=MYfmLtlnZxcLHtK6yNNs6_HC_ppmIcV038M40Ryopnw,4535
18
+ otari_cli/commands/message.py,sha256=FYMgleOa0Yr6DWq_7KxuItWty5q2oBEgTwRAE0O8R8I,3090
19
+ otari_cli/commands/models.py,sha256=sQXEuj23lHw4E0KmjO2Q0-_IyJAe2aCSkbEcbAUqD7Q,845
20
+ otari_cli/commands/moderation.py,sha256=rDksL-YaAwFVOM7u31ET9LZSt2k-3RAEOGsqH8JFMCo,1051
21
+ otari_cli/commands/pricing.py,sha256=Fh9c2ZRrpXOwD0VfvlFRn-7VYZzkn7DSVJN2fwbN2Uk,3865
22
+ otari_cli/commands/rerank.py,sha256=pEJFUHO0Plh7ncYQcgwNnPDfG-V9eV4yWFjilK6vJF4,1113
23
+ otari_cli/commands/response.py,sha256=gbrZj-eBSlb9jn-yg9K6P0_V3yelXhEMZQVyIydeWYM,2542
24
+ otari_cli/commands/usage.py,sha256=XQXApJYl-IjcLLR2mHkzkw0-dDDgZYt8Anpu94ARjeE,1722
25
+ otari_cli/commands/users.py,sha256=zUa79LCplZO8PECv2NR4cL4MReR8y8fn-jDlpln1D7U,4719
26
+ otari_cli-0.1.0.dist-info/METADATA,sha256=lcWm424qhWJ6wV2cmkc_w7in0vpa2tTIT7e-WCX4cjo,5873
27
+ otari_cli-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
28
+ otari_cli-0.1.0.dist-info/entry_points.txt,sha256=Q-igUQugb-NPE5bMk0ELD4gxDn6SOct2dT1AeDimrpM,45
29
+ otari_cli-0.1.0.dist-info/licenses/LICENSE,sha256=HhTApu-Z9745syeuHuki0D0Xb6vKrokTMXt8E88h-5Y,11340
30
+ otari_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ otari = otari_cli.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Mozilla.ai
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.