@dianshuv/copilot-api 0.21.12 → 0.21.14

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.
Files changed (3) hide show
  1. package/README.md +32 -3
  2. package/dist/main.mjs +114 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -80,7 +80,7 @@ make down
80
80
 
81
81
  ### Hidden Models
82
82
 
83
- By default the proxy hides 53 stale / duplicate / unused upstream model ids from
83
+ By default the proxy hides 55 stale / duplicate / unused upstream model ids from
84
84
  its **listing surfaces** (`/v1/models` and the startup banner).
85
85
 
86
86
  **Important**: this is a *display* filter only. The remaining POST endpoints
@@ -99,12 +99,12 @@ Currently hidden (grouped):
99
99
  - **GPT-4o family** — `gpt-4o`, `gpt-4o-mini`, `gpt-4-o-preview`, `gpt-4o-2024-05-13`, `gpt-4o-2024-08-06`, `gpt-4o-2024-11-20`, `gpt-4o-mini-2024-07-18`
100
100
  - **GPT-4.1 family** — `gpt-4.1`, `gpt-4.1-2025-04-14`, `gpt-41-copilot`
101
101
  - **Older / superseded GPT-5** — `gpt-5-mini`, `gpt-5.3-codex`, `gpt-5.4`, `gpt-5.4-mini`, `gpt-5.4-nano`, `gpt-5.5`, `gpt-5.6-luna`, `gpt-5.6-sol`, `gpt-5.6-sol-fast`, `gpt-5.6-terra`
102
- - **Hidden GPT-6** — `gpt-6-sol`, `gpt-6-astra`
102
+ - **Hidden GPT-6** — `gpt-6-sol`, `gpt-6-astra`, `gpt-6-luna-decisions`
103
103
  - **All embeddings** — `text-embedding-ada-002`, `text-embedding-3-small`, `text-embedding-3-small-inference`
104
104
  - **Hidden Gemini** — `gemini-2.5-pro`, `gemini-3-flash-preview`, `gemini-3.1-pro-preview`, `gemini-3.5-flash`, `gemini-3.6-flash`, `gemini-3.7-flash`, `gemini-3.8-flash`
105
105
  - **Older Grok** — `grok-4.5`, `grok-4.6`
106
106
  - **Older / variant Claude** — `claude-opus-4.5`, `claude-opus-4.6`, `claude-opus-4.7`, `claude-opus-4.8`, `claude-opus-4.7-high`, `claude-opus-4.7-xhigh`, `claude-sonnet-4.5`, `claude-sonnet-4.6`
107
- - **Special-purpose** — `gpt-5.6-luna-utility`, `mai-code-1-flash-internal`, `mai-code-1-flash-picker`, `mai-code-1.1-flash`, `mai-code-2-flash`, `trajectory-compaction`
107
+ - **Special-purpose** — `gpt-5.6-luna-utility`, `mai-code-1-flash-internal`, `mai-code-1-flash-picker`, `mai-code-1.1-flash`, `mai-code-2-flash`, `mai-code-2`, `trajectory-compaction`
108
108
 
109
109
  ## API Endpoints
110
110
 
@@ -124,6 +124,35 @@ Currently hidden (grouped):
124
124
  | `/v1/messages/count_tokens` | POST | Token counting |
125
125
  | `/v1/event_logging/batch` | POST | Event logging (no-op) |
126
126
 
127
+ ### Native Decision API
128
+
129
+ | Endpoint | Method | Description |
130
+ |----------|--------|-------------|
131
+ | `/v1/systemone` | POST | Native decision scoring with `microsoft-decision-1` |
132
+
133
+ This endpoint forwards the native `model`, `state`, and `questions` request without chat or Responses API translation. Questions can use `noul` (binary probability), `choice`, or `score`. The selected model must advertise `/v1/systemone` in Copilot's model metadata; availability depends on the account and Copilot policy. It is not a streaming endpoint.
134
+
135
+ Example request body:
136
+
137
+ ```json
138
+ {
139
+ "model": "microsoft-decision-1",
140
+ "state": { "integer": 2 },
141
+ "questions": {
142
+ "positive": {
143
+ "type": "noul",
144
+ "instructions": "Is the integer in state greater than zero?",
145
+ "criteria": {
146
+ "true": "The integer is strictly positive.",
147
+ "false": "The integer is zero or negative."
148
+ }
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ The response retains native `answers` and `usage` fields. As with other inference endpoints, the client-facing `model` echoes the requested ID; history and analytics retain Copilot's actual returned model (which can differ). The endpoint uses the same Proxy API key authentication, manual approval, retry handling, and upstream error formatting as the existing APIs. History records it under the `systemone` endpoint filter.
155
+
127
156
  ### Utility
128
157
 
129
158
  | Endpoint | Method | Description |
package/dist/main.mjs CHANGED
@@ -1035,7 +1035,7 @@ const logout = defineCommand({
1035
1035
 
1036
1036
  //#endregion
1037
1037
  //#region package.json
1038
- var version = "0.21.12";
1038
+ var version = "0.21.14";
1039
1039
 
1040
1040
  //#endregion
1041
1041
  //#region src/lib/event-loop-lag.ts
@@ -2526,6 +2526,7 @@ const HIDDEN_MODEL_IDS = new Set([
2526
2526
  "gpt-5.6-terra",
2527
2527
  "gpt-6-sol",
2528
2528
  "gpt-6-astra",
2529
+ "gpt-6-luna-decisions",
2529
2530
  "text-embedding-ada-002",
2530
2531
  "text-embedding-3-small",
2531
2532
  "text-embedding-3-small-inference",
@@ -2551,6 +2552,7 @@ const HIDDEN_MODEL_IDS = new Set([
2551
2552
  "mai-code-1-flash-picker",
2552
2553
  "mai-code-1.1-flash",
2553
2554
  "mai-code-2-flash",
2555
+ "mai-code-2",
2554
2556
  "trajectory-compaction"
2555
2557
  ]);
2556
2558
  function isHiddenModel(id, showAll) {
@@ -6083,6 +6085,7 @@ const template = `
6083
6085
  <option value="">All Endpoints</option>
6084
6086
  <option value="anthropic">Anthropic</option>
6085
6087
  <option value="openai">OpenAI</option>
6088
+ <option value="systemone">SystemOne</option>
6086
6089
  </select>
6087
6090
  <select id="filter-status" onchange="loadEntries()">
6088
6091
  <option value="">All Status</option>
@@ -9264,6 +9267,115 @@ responsesRoutes.post("/", async (c) => {
9264
9267
  }
9265
9268
  });
9266
9269
 
9270
+ //#endregion
9271
+ //#region src/services/copilot/create-systemone.ts
9272
+ async function createSystemOne(payload, resolvedModel, signal) {
9273
+ if (!state.copilotToken) throw new Error("Copilot token not found");
9274
+ const response = await copilotFetch("/v1/systemone", {
9275
+ method: "POST",
9276
+ headers: copilotHeaders(state, { modelRequestHeaders: resolvedModel.request_headers }),
9277
+ body: JSON.stringify(payload),
9278
+ signal
9279
+ });
9280
+ if (!response.ok) throw await HTTPError.fromResponse("Failed to create SystemOne decisions", response, payload.model);
9281
+ return await response.json();
9282
+ }
9283
+
9284
+ //#endregion
9285
+ //#region src/routes/systemone/handler.ts
9286
+ async function handleSystemOne(c) {
9287
+ let rawPayload;
9288
+ try {
9289
+ rawPayload = await c.req.json();
9290
+ } catch {
9291
+ return c.json({ error: {
9292
+ type: "invalid_request_error",
9293
+ message: "Request body must be valid JSON"
9294
+ } }, 400);
9295
+ }
9296
+ if (rawPayload === null || typeof rawPayload.model !== "string" || rawPayload.model.length === 0) return c.json({ error: {
9297
+ type: "invalid_request_error",
9298
+ message: "model is required and must be a non-empty string"
9299
+ } }, 400);
9300
+ const selectedModel = findModelById(rawPayload.model);
9301
+ if (!selectedModel?.supported_endpoints?.includes("/v1/systemone")) return c.json({ error: {
9302
+ type: "invalid_request_error",
9303
+ message: "This model does not support the SystemOne endpoint."
9304
+ } }, 400);
9305
+ const { ctx, payload } = createEntryContext({
9306
+ c,
9307
+ rawPayload,
9308
+ endpoint: "systemone",
9309
+ buildHistoryRequest: (p) => ({
9310
+ model: p.model,
9311
+ messages: [{
9312
+ role: "user",
9313
+ content: JSON.stringify({
9314
+ state: p.state,
9315
+ questions: p.questions
9316
+ })
9317
+ }],
9318
+ stream: false
9319
+ })
9320
+ });
9321
+ if (state.manualApprove) await awaitApproval();
9322
+ const abort = clientAbortController(c);
9323
+ try {
9324
+ const { result, queueWaitMs } = await executeWithAdaptiveRateLimit(() => createSystemOne(payload, selectedModel, abort.signal));
9325
+ const inputTokens = result.usage?.input_tokens ?? 0;
9326
+ const outputTokens = result.usage?.output_tokens ?? 0;
9327
+ recordResponse(ctx.historyId, {
9328
+ success: true,
9329
+ model: result.model,
9330
+ usage: {
9331
+ input_tokens: inputTokens,
9332
+ output_tokens: outputTokens
9333
+ },
9334
+ content: {
9335
+ role: "assistant",
9336
+ content: JSON.stringify(result.answers)
9337
+ }
9338
+ }, Date.now() - ctx.startTime);
9339
+ updateTrackerResolvedModel(ctx.trackingId, result.model);
9340
+ completeTracking(ctx.trackingId, inputTokens, outputTokens, queueWaitMs, void 0, {
9341
+ model: result.model,
9342
+ stream: false,
9343
+ durationMs: Date.now() - ctx.startTime,
9344
+ tokenPrices: result.usage ? selectedModel.billing?.token_prices : void 0
9345
+ }, ctx.timings);
9346
+ return c.json(echoResponseBody(result, ctx));
9347
+ } catch (error) {
9348
+ if (isAbortError(error)) {
9349
+ recordResponse(ctx.historyId, {
9350
+ success: false,
9351
+ model: payload.model,
9352
+ usage: {
9353
+ input_tokens: 0,
9354
+ output_tokens: 0
9355
+ },
9356
+ error: "client disconnected",
9357
+ content: null
9358
+ }, Date.now() - ctx.startTime);
9359
+ failTracking(ctx.trackingId, "client disconnected");
9360
+ return new Response(null, { status: 499 });
9361
+ }
9362
+ recordErrorResponse(ctx, payload.model, error, "systemone", false);
9363
+ failTracking(ctx.trackingId, error);
9364
+ throw error;
9365
+ }
9366
+ }
9367
+
9368
+ //#endregion
9369
+ //#region src/routes/systemone/route.ts
9370
+ const systemOneRoutes = new Hono();
9371
+ systemOneRoutes.post("/", async (c) => {
9372
+ try {
9373
+ return await handleSystemOne(c);
9374
+ } catch (error) {
9375
+ return forwardError(c, error);
9376
+ }
9377
+ });
9378
+
9267
9379
  //#endregion
9268
9380
  //#region src/routes/token/route.ts
9269
9381
  const tokenRoute = new Hono();
@@ -9324,6 +9436,7 @@ server.route("/v1/messages", messageRoutes);
9324
9436
  server.route("/api/event_logging", eventLoggingRoutes);
9325
9437
  server.route("/v1/responses", responsesRoutes);
9326
9438
  server.route("/responses", responsesRoutes);
9439
+ server.route("/v1/systemone", systemOneRoutes);
9327
9440
  server.route("/history", historyRoutes);
9328
9441
 
9329
9442
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dianshuv/copilot-api",
3
- "version": "0.21.12",
3
+ "version": "0.21.14",
4
4
  "description": "Turn GitHub Copilot into OpenAI/Anthropic API compatible server. Usable with Claude Code!",
5
5
  "author": "dianshuv",
6
6
  "type": "module",