<%- include("partials/shared_header", { title: "Import Users - OAI Reverse Proxy Admin" }) %>
<h1>Import Users</h1>
<p>
  Import users from JSON. The JSON should be an array of objects under the key
  <code>users</code>. Each object should have the following fields:
</p>
<ul>
  <li><code>token</code> (required): a unique identifier for the user</li>
  <li><code>nickname</code> (optional): a nickname for the user, max 80 chars</li>
  <li><code>ip</code> (optional): IP addresses the user has connected from</li>
  <li>
    <code>type</code> (optional): either <code>normal</code> or
    <code>special</code>
  </li>
  <li>
    <code>promptCount</code> (optional): the number of times the user has sent a
    prompt
  </li>
  <li>
    <code>tokenCounts</code> (optional): the number of tokens the user has
    consumed. This should be an object with model family keys (e.g. <code>turbo</code>,
    <code>gpt4</code>, <code>claude</code>), each containing an object with 
    <code>input</code> and <code>output</code> token counts.
  </li>
  <li>
    <code>tokenLimits</code> (optional): the maximum number of tokens the user can
    consume. This should be an object with model family keys (e.g. <code>turbo</code>,
    <code>gpt4</code>, <code>claude</code>), each containing a single number 
    representing the total token quota.
  </li>
  <li>
    <code>tokenRefresh</code> (optional): the amount of tokens to refresh when quotas 
    are reset. Same format as <code>tokenLimits</code>.
  </li>
  <li>
    <code>createdAt</code> (optional): the timestamp when the user was created
  </li>
  <li>
    <code>disabledAt</code> (optional): the timestamp when the user was disabled
  </li>
  <li>
    <code>disabledReason</code> (optional): the reason the user was disabled
  </li>
</ul>
<p>
  If a user with the same token already exists, the existing user will be
  updated with the new values.
</p>
<form action="/admin/manage/import-users?_csrf=<%= csrfToken %>" method="post" enctype="multipart/form-data">
  <input type="file" name="users" />
  <input type="submit" value="Import" />
</form>
</form>
<%- include("partials/admin-footer") %>
