Skip to content

Commit 9515b22

Browse files
authored
docs: document dynamic port assignment and remove hardcoded 5272 references (#447)
Foundry Local assigns a dynamic port on each service start. This commit: - Replaces hardcoded localhost:5272 in the architecture diagram and BYOK table - Updates code comments to note the port is dynamically assigned - Adds an IMPORTANT callout in the README SDK section about dynamic ports - Documents 'foundry service status' as the CLI discovery method Related to #424
1 parent fcfea4a commit 9515b22

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ This will show you a list of all models that can be run locally, including their
7171

7272
Foundry Local has an easy-to-use SDK (C#, Python, JavaScript) to get you started with existing applications:
7373

74+
> [!IMPORTANT]
75+
> Foundry Local assigns a **dynamic port** each time the service starts -- do not hardcode `localhost:5272` or any other port. Use the SDK's `manager.endpoint` property to obtain the correct URL at runtime. For CLI or `curl` usage, run `foundry service status` to discover the current endpoint.
76+
7477
### C#
7578
7679
The C# SDK is available as a package on NuGet. You can install it using the .NET CLI:

docs/copilot-sdk-integration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Your Application
1717
|
1818
├─ JSON-RPC ──→ Copilot CLI (agent orchestration, tool execution)
1919
|
20-
└─ BYOK provider: { type: "openai", baseUrl: "http://localhost:5272/v1" }
20+
└─ BYOK provider: { type: "openai", baseUrl: manager.endpoint }
2121
|
2222
└─ POST /v1/chat/completions ──→ Foundry Local (on-device inference)
2323
|
@@ -64,7 +64,7 @@ const session = await client.createSession({
6464
model: modelInfo.id,
6565
provider: {
6666
type: "openai",
67-
baseUrl: manager.endpoint, // e.g., "http://localhost:5272/v1"
67+
baseUrl: manager.endpoint, // Dynamically assigned; never hardcode the port
6868
apiKey: manager.apiKey,
6969
wireApi: "completions", // Foundry Local uses Chat Completions API
7070
},
@@ -231,7 +231,7 @@ The `provider` object in `createSession()` configures where Copilot SDK sends in
231231
| Field | Type | Description |
232232
|-------|------|-------------|
233233
| `type` | `"openai"` | Provider type. Use `"openai"` for Foundry Local (OpenAI-compatible) |
234-
| `baseUrl` | string | Foundry Local endpoint, e.g., `"http://localhost:5272/v1"` |
234+
| `baseUrl` | string | Foundry Local endpoint (port is dynamically assigned). Use `manager.endpoint` from the SDK, or run `foundry service status` to discover the URL. |
235235
| `apiKey` | string | API key (optional for local endpoints) |
236236
| `wireApi` | `"completions"` \| `"responses"` | API format. Use `"completions"` for Foundry Local |
237237

samples/js/copilot-sdk-foundry-local/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const session = await client.createSession({
111111
model: modelInfo.id,
112112
provider: {
113113
type: "openai", // Foundry Local exposes OpenAI-compatible API
114-
baseUrl: manager.endpoint, // e.g., "http://localhost:5272/v1"
114+
baseUrl: manager.endpoint, // Dynamically assigned; never hardcode the port
115115
apiKey: manager.apiKey,
116116
wireApi: "completions", // Chat Completions API format
117117
},

0 commit comments

Comments
 (0)