Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,19 @@ session, err := client.CreateSession(&copilot.SessionConfig{
session, err := client.CreateSession(&copilot.SessionConfig{
Model: "gpt-4",
Provider: &copilot.ProviderConfig{
Type: "azure",
BaseURL: "https://my-resource.openai.azure.com",
Type: "azure", // Must be "azure" for Azure endpoints, NOT "openai"
BaseURL: "https://my-resource.openai.azure.com", // Just the host, no path
APIKey: os.Getenv("AZURE_OPENAI_KEY"),
Azure: &copilot.AzureProviderOptions{
APIVersion: "2024-10-21",
},
},
})
```

> **Note:** When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
> **Important notes:**
> - When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section states that model is required for custom providers and that the SDK will throw/return an error if it’s missing, but the Go SDK currently allows creating/resuming sessions with a Provider and an empty Model (and tests cover provider-only configs). Please update the docs to match, or add validation in the client to enforce the requirement.

Suggested change
> - When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
> - When using a custom provider, specifying the `Model` parameter is **recommended**, but the Go SDK does **not** currently enforce it. If you omit `Model`, behavior (such as using a provider-specific default model or returning an error) depends on your configured provider.

Copilot uses AI. Check for mistakes.
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `Type: "azure"`, not `Type: "openai"`.
> - 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.
## Transport Modes

Expand Down
9 changes: 6 additions & 3 deletions nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ const session = await client.createSession({
const session = await client.createSession({
model: "gpt-4",
provider: {
type: "azure",
baseUrl: "https://my-resource.openai.azure.com",
type: "azure", // Must be "azure" for Azure endpoints, NOT "openai"
baseUrl: "https://my-resource.openai.azure.com", // Just the host, no path
apiKey: process.env.AZURE_OPENAI_KEY,
azure: {
apiVersion: "2024-10-21",
Expand All @@ -465,7 +465,10 @@ const session = await client.createSession({
});
```

> **Note:** When using a custom provider, the `model` parameter is **required**. The SDK will throw an error if no model is specified.
> **Important notes:**
> - When using a custom provider, the `model` parameter is **required**. The SDK will throw an error if no model is specified.
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `type: "azure"`, not `type: "openai"`.
> - 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.
## Error Handling

Expand Down
76 changes: 76 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ await client.stop()
- `auto_start` (bool): Auto-start server on first use (default: True)
- `auto_restart` (bool): Auto-restart on crash (default: True)

**SessionConfig Options (for `create_session`):**

- `model` (str): Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
- `session_id` (str): Custom session ID
- `tools` (list): Custom tools exposed to the CLI
- `system_message` (dict): System message configuration
- `streaming` (bool): Enable streaming delta events
- `provider` (dict): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
- `infinite_sessions` (dict): Automatic context compaction configuration

### Tools

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

## Custom Providers

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.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs state that when using a custom provider you must specify model and that the SDK will throw an error otherwise, but the SDK currently allows creating sessions with provider and no model (e.g., python/e2e/test_session.py creates a session with provider only). Please update this text to match actual behavior, or implement/enforce this validation in the SDK if it is truly required.

Copilot uses AI. Check for mistakes.

**ProviderConfig fields:**

- `type` (str): Provider type - `"openai"`, `"azure"`, or `"anthropic"` (default: `"openai"`)
- `base_url` (str): API endpoint URL (required)
- `api_key` (str): API key (optional for local providers like Ollama)
- `bearer_token` (str): Bearer token for authentication (takes precedence over `api_key`)
- `wire_api` (str): API format for OpenAI/Azure - `"completions"` or `"responses"` (default: `"completions"`)
- `azure` (dict): Azure-specific options with `api_version` (default: `"2024-10-21"`)

**Example with Ollama:**

```python
session = await client.create_session({
"model": "deepseek-coder-v2:16b", # Required when using custom provider
"provider": {
"type": "openai",
"base_url": "http://localhost:11434/v1", # Ollama endpoint
# api_key not required for Ollama
},
})

await session.send({"prompt": "Hello!"})
```

**Example with custom OpenAI-compatible API:**

```python
import os

session = await client.create_session({
"model": "gpt-4",
"provider": {
"type": "openai",
"base_url": "https://my-api.example.com/v1",
"api_key": os.environ["MY_API_KEY"],
},
})
```

**Example with Azure OpenAI:**

```python
import os

session = await client.create_session({
"model": "gpt-4",
"provider": {
"type": "azure", # Must be "azure" for Azure endpoints, NOT "openai"
"base_url": "https://my-resource.openai.azure.com", # Just the host, no path
"api_key": os.environ["AZURE_OPENAI_KEY"],
"azure": {
"api_version": "2024-10-21",
},
Comment on lines +329 to +342
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title mentions “need version for Azure Foundry”, but the added documentation focuses on BYOK/custom providers and doesn’t mention Azure Foundry-specific versioning requirements beyond the generic api_version example/default. Please adjust the title or add the missing Azure Foundry guidance so the PR intent matches the content.

Copilot uses AI. Check for mistakes.
},
})
```

> **Important notes:**
> - When using a custom provider, the `model` parameter is **required**. The SDK will throw an error if no model is specified.
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `type: "azure"`, not `type: "openai"`.
> - 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.
## Requirements

- Python 3.9+
Expand Down
Loading