Skip to content

Commit ea2a69a

Browse files
authored
Update docs to reflect you need version for Azure Foundry (github#260)
* Add provider info to docs * docs: add custom provider documentation across all SDKs - Add Custom Providers section to Node.js, Go, and Python READMEs - Document ProviderConfig options with examples for Ollama, OpenAI-compatible APIs, and Azure OpenAI - Add SessionConfig documentation with provider option - Highlight important notes: - Model is required when using custom providers - Azure endpoints require type 'azure', not 'openai' - Base URL should not include /openai/v1 path
1 parent d8f3425 commit ea2a69a

File tree

3 files changed

+88
-7
lines changed

3 files changed

+88
-7
lines changed

go/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,19 @@ session, err := client.CreateSession(&copilot.SessionConfig{
383383
session, err := client.CreateSession(&copilot.SessionConfig{
384384
Model: "gpt-4",
385385
Provider: &copilot.ProviderConfig{
386-
Type: "azure",
387-
BaseURL: "https://my-resource.openai.azure.com",
386+
Type: "azure", // Must be "azure" for Azure endpoints, NOT "openai"
387+
BaseURL: "https://my-resource.openai.azure.com", // Just the host, no path
388388
APIKey: os.Getenv("AZURE_OPENAI_KEY"),
389389
Azure: &copilot.AzureProviderOptions{
390390
APIVersion: "2024-10-21",
391391
},
392392
},
393393
})
394394
```
395-
396-
> **Note:** When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
395+
> **Important notes:**
396+
> - When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
397+
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `Type: "azure"`, not `Type: "openai"`.
398+
> - The `BaseURL` should be just the host (e.g., `https://my-resource.openai.azure.com`). Do **not** include `/openai/v1` in the URL - the SDK handles path construction automatically.
397399
398400
## Transport Modes
399401

nodejs/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ const session = await client.createSession({
455455
const session = await client.createSession({
456456
model: "gpt-4",
457457
provider: {
458-
type: "azure",
459-
baseUrl: "https://my-resource.openai.azure.com",
458+
type: "azure", // Must be "azure" for Azure endpoints, NOT "openai"
459+
baseUrl: "https://my-resource.openai.azure.com", // Just the host, no path
460460
apiKey: process.env.AZURE_OPENAI_KEY,
461461
azure: {
462462
apiVersion: "2024-10-21",
@@ -465,7 +465,10 @@ const session = await client.createSession({
465465
});
466466
```
467467

468-
> **Note:** When using a custom provider, the `model` parameter is **required**. The SDK will throw an error if no model is specified.
468+
> **Important notes:**
469+
> - When using a custom provider, the `model` parameter is **required**. The SDK will throw an error if no model is specified.
470+
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `type: "azure"`, not `type: "openai"`.
471+
> - The `baseUrl` should be just the host (e.g., `https://my-resource.openai.azure.com`). Do **not** include `/openai/v1` in the URL - the SDK handles path construction automatically.
469472
470473
## Error Handling
471474

python/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ await client.stop()
9696
- `auto_start` (bool): Auto-start server on first use (default: True)
9797
- `auto_restart` (bool): Auto-restart on crash (default: True)
9898

99+
**SessionConfig Options (for `create_session`):**
100+
101+
- `model` (str): Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
102+
- `session_id` (str): Custom session ID
103+
- `tools` (list): Custom tools exposed to the CLI
104+
- `system_message` (dict): System message configuration
105+
- `streaming` (bool): Enable streaming delta events
106+
- `provider` (dict): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
107+
- `infinite_sessions` (dict): Automatic context compaction configuration
108+
99109
### Tools
100110

101111
Define tools with automatic JSON schema generation using the `@define_tool` decorator and Pydantic models:
@@ -273,6 +283,72 @@ When enabled, sessions emit compaction events:
273283
- `session.compaction_start` - Background compaction started
274284
- `session.compaction_complete` - Compaction finished (includes token counts)
275285

286+
## Custom Providers
287+
288+
The SDK supports custom OpenAI-compatible API providers (BYOK - Bring Your Own Key), including local providers like Ollama. When using a custom provider, you must specify the `model` explicitly.
289+
290+
**ProviderConfig fields:**
291+
292+
- `type` (str): Provider type - `"openai"`, `"azure"`, or `"anthropic"` (default: `"openai"`)
293+
- `base_url` (str): API endpoint URL (required)
294+
- `api_key` (str): API key (optional for local providers like Ollama)
295+
- `bearer_token` (str): Bearer token for authentication (takes precedence over `api_key`)
296+
- `wire_api` (str): API format for OpenAI/Azure - `"completions"` or `"responses"` (default: `"completions"`)
297+
- `azure` (dict): Azure-specific options with `api_version` (default: `"2024-10-21"`)
298+
299+
**Example with Ollama:**
300+
301+
```python
302+
session = await client.create_session({
303+
"model": "deepseek-coder-v2:16b", # Required when using custom provider
304+
"provider": {
305+
"type": "openai",
306+
"base_url": "http://localhost:11434/v1", # Ollama endpoint
307+
# api_key not required for Ollama
308+
},
309+
})
310+
311+
await session.send({"prompt": "Hello!"})
312+
```
313+
314+
**Example with custom OpenAI-compatible API:**
315+
316+
```python
317+
import os
318+
319+
session = await client.create_session({
320+
"model": "gpt-4",
321+
"provider": {
322+
"type": "openai",
323+
"base_url": "https://my-api.example.com/v1",
324+
"api_key": os.environ["MY_API_KEY"],
325+
},
326+
})
327+
```
328+
329+
**Example with Azure OpenAI:**
330+
331+
```python
332+
import os
333+
334+
session = await client.create_session({
335+
"model": "gpt-4",
336+
"provider": {
337+
"type": "azure", # Must be "azure" for Azure endpoints, NOT "openai"
338+
"base_url": "https://my-resource.openai.azure.com", # Just the host, no path
339+
"api_key": os.environ["AZURE_OPENAI_KEY"],
340+
"azure": {
341+
"api_version": "2024-10-21",
342+
},
343+
},
344+
})
345+
```
346+
347+
> **Important notes:**
348+
> - When using a custom provider, the `model` parameter is **required**. The SDK will throw an error if no model is specified.
349+
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `type: "azure"`, not `type: "openai"`.
350+
> - The `base_url` should be just the host (e.g., `https://my-resource.openai.azure.com`). Do **not** include `/openai/v1` in the URL - the SDK handles path construction automatically.
351+
276352
## Requirements
277353

278354
- Python 3.9+

0 commit comments

Comments
 (0)