copilot-api-node20 0.44.2 → 0.45.0

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.
package/README.md CHANGED
@@ -20,7 +20,8 @@ Want Claude Code on GPT and other non-Claude models? Pick one from your Copilot
20
20
  Codex CLI ─┤───── or ─────────▶│ copilot-api │──────┤ Chat Completions
21
21
  OpenAI SDK ─┤ /v1/chat/ └─────────────┘ │ Responses API
22
22
  curl ─┤ completions │ Embeddings
23
- Any tool ─┘ │
23
+ Any tool ─┘ │ Images
24
+ │
24
25
  ├─▶ Microsoft Foundry /
25
26
  │ Azure OpenAI
26
27
  │ (--provider foundry)
@@ -37,6 +38,7 @@ Want Claude Code on GPT and other non-Claude models? Pick one from your Copilot
37
38
  - [Claude Code](#claude-code)
38
39
  - [Codex CLI](#codex-cli)
39
40
  - [Web Search](#web-search)
41
+ - [Image Generation](#image-generation)
40
42
  - [Claude Cowork](#claude-cowork)
41
43
  - [Microsoft Foundry / Azure OpenAI](#microsoft-foundry--azure-openai)
42
44
  - [API Endpoints](#api-endpoints)
@@ -63,6 +65,7 @@ Want Claude Code on GPT and other non-Claude models? Pick one from your Copilot
63
65
  | **Microsoft Foundry / Azure OpenAI** | Your own Azure deployments with `--provider foundry`: API key or Entra ID (`az login`, managed identity, service principal), no GitHub account needed |
64
66
  | **Copilot fallback** | `--fallback copilot`: Copilot answers when Foundry rate-limits, errors or times out, and finishes a Claude Code turn on an OpenAI deployment whose stream fails before any output; then traffic moves back to Foundry |
65
67
  | **Web search** | Optional web search for Claude Code and Codex sessions, via **Tavily and/or Exa** with automatic failover |
68
+ | **Image generation & editing** | OpenAI **Images API** on Copilot's **GPT Image 2.5 Flare**: text-to-image, edits and multi-image composition, exact text rendering, transparent PNGs — see [Image Generation](#image-generation) |
66
69
  | **Dual API compatibility** | OpenAI Chat Completions, Anthropic Messages, and OpenAI Responses APIs side by side |
67
70
  | **HTTPS with auto-generated certs** | Self-signed TLS certs with configurable SANs -- works across VMs, containers, and LAN |
68
71
  | **Zero configuration** | Single command to start -- authenticates via GitHub device-code OAuth |
@@ -159,6 +162,64 @@ The `--tavily-api-key` flag is **deprecated** — it still works and is equivale
159
162
  to `TAVILY_API_KEY`, but prints a deprecation warning on startup. Prefer the
160
163
  environment variables, which also keep keys out of the process list.
161
164
 
165
+ ### Image Generation
166
+
167
+ Copilot now serves an image model, **GPT Image 2.5 Flare** (`gpt-image-2.5-flare`, preview). The proxy exposes it through the standard **OpenAI Images API**, so any OpenAI SDK or tool that generates images works unchanged — no extra flags.
168
+
169
+ **Generate** an image:
170
+
171
+ ```bash
172
+ curl -s http://localhost:4141/v1/images/generations \
173
+ -H "Content-Type: application/json" \
174
+ -d '{
175
+ "model": "gpt-image-2.5-flare",
176
+ "prompt": "A red fox reading a newspaper at a beach cafe, watercolor",
177
+ "size": "1024x1024",
178
+ "quality": "medium"
179
+ }' | jq -r '.data[0].b64_json' | base64 --decode > fox.png
180
+ ```
181
+
182
+ **Edit** an image (or combine several — repeat `image[]`). JSON edits with `images: [{"image_url": "data:..."}]`, as Codex sends them, work too:
183
+
184
+ ```bash
185
+ curl -s http://localhost:4141/v1/images/edits \
186
+ -F model=gpt-image-2.5-flare \
187
+ -F prompt="Give the fox a straw sun hat" \
188
+ -F "image[]=@fox.png" \
189
+ | jq -r '.data[0].b64_json' | base64 --decode > fox-hat.png
190
+ ```
191
+
192
+ With the OpenAI Python SDK:
193
+
194
+ ```python
195
+ import base64
196
+ from openai import OpenAI
197
+
198
+ client = OpenAI(base_url="http://localhost:4141/v1", api_key="dummy")
199
+ img = client.images.generate(
200
+ model="gpt-image-2.5-flare",
201
+ prompt="A minimalist poster that says 'HELLO WORLD'",
202
+ size="1024x1536",
203
+ quality="high",
204
+ )
205
+ open("poster.png", "wb").write(base64.b64decode(img.data[0].b64_json))
206
+ ```
207
+
208
+ | Option | Values |
209
+ |:--|:--|
210
+ | `size` | `1024x1024`, `1024x1536`, `1536x1024`, or a custom size **up to 3840×2160 (4K)**: longest edge ≤ 3840, aspect ratio 1:3 to 3:1, both sides divisible by 16 |
211
+ | `quality` | `low`, `medium`, `high` (about 8–16 s per image at 1K, up to ~35 s at 4K) |
212
+ | `output_format` | `png`, `jpeg` (with `output_compression`) |
213
+ | `background` | `transparent` for PNGs with an alpha channel |
214
+ | `n` | Several images per request |
215
+
216
+ Good to know:
217
+
218
+ - Images are billed by Copilot as **AI credits**, separately from chat models — roughly **0.6** (low) to **4** (high) credits per 1024×1024 image, and about **10** for a high-quality 4K image.
219
+ - Available on Copilot Pro, Pro+, Business and Enterprise (not Free or Student). Organization admins can turn it off with the model policy.
220
+ - `gpt-image-2.5-flare` works only on the Images endpoints, not on Chat Completions or Responses. Streaming (`stream: true`) is not supported by Copilot yet.
221
+ - Edit uploads are limited to 100 MB per request. Image endpoints are Copilot-only (not available with `--provider foundry`).
222
+
162
223
  ### Claude Cowork
163
224
 
164
225
  Use Claude's desktop app ([Cowork](https://claude.ai/desktop)) with your Copilot subscription. Requires [Tailscale](https://tailscale.com) (free for personal use) for a real Let's Encrypt TLS certificate — no self-signed cert headaches.
@@ -266,6 +327,9 @@ All endpoints are served at `http://localhost:4141` by default (`https://` when
266
327
  | `POST` | `/v1/messages/count_tokens` | Anthropic Token Counting |
267
328
  | `POST` | `/v1/embeddings` | OpenAI Embeddings |
268
329
  | `POST` | `/embeddings` | OpenAI Embeddings without the `/v1` prefix |
330
+ | `POST` | `/v1/images/generations` | OpenAI Images: generate (for example `gpt-image-2.5-flare`) |
331
+ | `POST` | `/v1/images/edits` | OpenAI Images: edit (multipart/form-data, 100 MB body limit) |
332
+ | `POST` | `/images/generations`, `/images/edits` | OpenAI Images without the `/v1` prefix |
269
333
  | `GET` | `/v1/models` | OpenAI Models |
270
334
  | `GET` | `/models` | OpenAI Models without the `/v1` prefix |
271
335
  | `GET` | `/usage` | GitHub Copilot usage and quota information |