# My Company AI: model access and RM AI Agent

Use `https://api.mycomai.com` as your API base URL. `https://mycomai.com` is
the website. A base URL must not include `/api`, a model slug, or `/ask`.

Create one application token per integration in Account Admin. Keep it in a
secret store or server environment variable. Never commit it, place it in a
public frontend bundle, or paste it into a support report.

## General support

General support is available to paid accounts with the `qwen:ask` permission.
That permission name applies to the approved general assistant regardless of
which underlying model provides the response. A token grants only the scopes
selected by its issuer.

1. Discover approved models with `GET /api/v1/assistant/models`.
2. Ask with `POST /api/v1/assistant/ask` and a JSON body such as
   `{"model":"general","question":"How should I organize a support knowledge base?"}`.
3. Send `Authorization: Bearer YOUR_APPLICATION_TOKEN` on both requests.

The `general` model also accepts the alias `support`. General support does not
search private documents or execute tools. Private questions use the separate
trained-model endpoints and their required scopes. A model-restricted token
cannot discover or search another private model.

```python
import os
import requests

base_url = "https://api.mycomai.com"
headers = {"Authorization": "Bearer " + os.environ["MYCOMAI_API_TOKEN"]}
models = requests.get(base_url + "/api/v1/assistant/models", headers=headers, timeout=15)
models.raise_for_status()
print(models.json()["models"])
reply = requests.post(
    base_url + "/api/v1/assistant/ask",
    headers=headers,
    json={"model": "general", "question": "Help me organize support topics."},
    timeout=180,
)
reply.raise_for_status()
print(reply.json()["answer"])
```

The public client schema is `https://api.mycomai.com/api/v1/openapi.json`.

## VS Code RM AI Agent

Save the API base URL above and your token in the extension's provider settings.
The token needs `vscode:use` and `qwen:ask` for general support. Open the RealLexi
model-selection command and choose **General mode**.

In extension 1.6.5, the corresponding settings are
`realMemoryAgent.modelSearchMode: "general"` and
`realMemoryAgent.modelSlug: ""`. A private model's display name in the chat-model
field does not change General mode. The extension appends `/api/vscode/...`
itself; supplying a private model's `/ask` URL will produce an invalid address.

## Usage limits and errors

Each customer account shares **8,000 input and output tokens per UTC month**
across members and API tokens. Workspace owners and administrators are included.
Context is capped at **8,000 tokens**, or the model's lower supported limit.
External replies are capped at **2,048 output tokens**. Input includes the
instructions and context actually processed by the model. Existing monthly
plan API-call allowances also apply.

The response's `usage.tokens` contains used, reserved, remaining, and reset time.
The output allowance can shrink when little capacity remains. Discovery remains
available at the limit. If a request times out and its consumption cannot yet be
confirmed, its reserved capacity can remain unavailable. Contact support about
unexpected reservations; retrying repeatedly may use additional capacity.

- **401:** Check that the token is valid and active.
- **403:** Check the token scopes and model access.
- **402:** The account allowance cannot fit the request; check the reset time.
- **413:** Shorten the context.
- **429:** Follow `Retry-After` before retrying.
- **503:** The model is temporarily unavailable; follow the retry delay.

Automatic overage charges are disabled. Exceeding the allowance does not
authorize a charge. Share only the status, error code, extension version and
time with support; redact credentials and private documents.
