Skip to content

Commit 5411d74

Browse files
committed
fix(sdk): default both SDKs to the www.sim.ai host
The apex https://sim.ai answers every request with a 301 to https://www.sim.ai, and fetch and requests replay a 301 POST as a GET with no body, so a default-configured execute call never reaches the API. Both SDKs now default to https://www.sim.ai. Patch-bump both to 0.2.1 so the publish workflows release the new default on merge to main, and note in the API reference that earlier versions still default to the apex.
1 parent dd24582 commit 5411d74

11 files changed

Lines changed: 25 additions & 25 deletions

File tree

‎apps/docs/content/docs/api-reference/python.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ from simstudio import SimStudioClient
3030
# Initialize the client
3131
client = SimStudioClient(
3232
api_key="your-api-key-here",
33-
base_url="https://www.sim.ai" # optional; the default https://sim.ai redirects to this host
33+
base_url="https://www.sim.ai" # optional, defaults to https://www.sim.ai
3434
)
3535

3636
# Execute a workflow
@@ -48,12 +48,12 @@ except Exception as error:
4848
#### Constructor
4949

5050
```python
51-
SimStudioClient(api_key: str, base_url: str = "https://sim.ai")
51+
SimStudioClient(api_key: str, base_url: str = "https://www.sim.ai")
5252
```
5353

5454
**Parameters:**
5555
- `api_key` (str): Your Sim API key
56-
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://sim.ai`, which redirects to `https://www.sim.ai`; set the `www` host explicitly)
56+
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`; versions before 0.2.1 default to `https://sim.ai`, which redirects to `https://www.sim.ai`, so set the `www` host explicitly on older versions)
5757

5858
#### Methods
5959

‎apps/docs/content/docs/api-reference/typescript.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { SimStudioClient } from 'simstudio-ts-sdk';
4444
// Initialize the client
4545
const client = new SimStudioClient({
4646
apiKey: 'your-api-key-here',
47-
baseUrl: 'https://www.sim.ai' // optional; the default https://sim.ai redirects to this host
47+
baseUrl: 'https://www.sim.ai' // optional, defaults to https://www.sim.ai
4848
});
4949

5050
// Execute a workflow
@@ -68,7 +68,7 @@ new SimStudioClient(config: SimStudioConfig)
6868

6969
**Configuration:**
7070
- `config.apiKey` (string): Your Sim API key
71-
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://sim.ai`, which redirects to `https://www.sim.ai`; set the `www` host explicitly)
71+
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`; versions before 0.2.1 default to `https://sim.ai`, which redirects to `https://www.sim.ai`, so set the `www` host explicitly on older versions)
7272

7373
#### Methods
7474

‎bun.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/python-sdk/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ from simstudio import SimStudioClient
3333
# Initialize the client
3434
client = SimStudioClient(
3535
api_key=os.getenv("SIM_API_KEY", "your-api-key-here"),
36-
base_url="https://sim.ai" # optional, defaults to https://sim.ai
36+
base_url="https://www.sim.ai" # optional, defaults to https://www.sim.ai
3737
)
3838

3939
# Execute a workflow
@@ -51,11 +51,11 @@ except Exception as error:
5151
#### Constructor
5252

5353
```python
54-
SimStudioClient(api_key: str, base_url: str = "https://sim.ai")
54+
SimStudioClient(api_key: str, base_url: str = "https://www.sim.ai")
5555
```
5656

5757
- `api_key` (str): Your Sim API key
58-
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://sim.ai`)
58+
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`)
5959

6060
#### Methods
6161

@@ -408,7 +408,7 @@ from simstudio import SimStudioClient
408408
# Using environment variables
409409
client = SimStudioClient(
410410
api_key=os.getenv("SIM_API_KEY"),
411-
base_url=os.getenv("SIM_BASE_URL", "https://sim.ai")
411+
base_url=os.getenv("SIM_BASE_URL", "https://www.sim.ai")
412412
)
413413
```
414414

‎packages/python-sdk/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "simstudio-sdk"
7-
version = "0.2.0"
7+
version = "0.2.1"
88
authors = [
99
{name = "Sim", email = "help@sim.ai"},
1010
]

‎packages/python-sdk/simstudio/__init__.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# rather than silently reporting True.
2222
_SUCCESSFUL_RUN_STATUSES = ('completed', 'paused')
2323

24-
__version__ = "0.2.0"
24+
__version__ = "0.2.1"
2525

2626

2727
def _client_headers() -> Dict[str, str]:
@@ -140,10 +140,10 @@ class SimStudioClient:
140140
141141
Args:
142142
api_key: Your Sim API key
143-
base_url: Base URL for the Sim API (defaults to https://sim.ai)
143+
base_url: Base URL for the Sim API (defaults to https://www.sim.ai)
144144
"""
145145

146-
def __init__(self, api_key: str, base_url: str = "https://sim.ai"):
146+
def __init__(self, api_key: str, base_url: str = "https://www.sim.ai"):
147147
self.api_key = api_key
148148
self.base_url = base_url.rstrip('/')
149149
self._session = requests.Session()

‎packages/python-sdk/tests/test_client.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_simstudio_client_default_base_url():
4646
"""Test SimStudioClient with default base URL."""
4747
client = SimStudioClient(api_key="test-api-key")
4848
assert client.api_key == "test-api-key"
49-
assert client.base_url == "https://sim.ai"
49+
assert client.base_url == "https://www.sim.ai"
5050

5151

5252
def test_set_api_key():
@@ -79,7 +79,7 @@ def test_validate_workflow_returns_false_on_error(mock_get):
7979
result = client.validate_workflow("test-workflow-id")
8080

8181
assert result is False
82-
mock_get.assert_called_once_with("https://sim.ai/api/workflows/test-workflow-id/status")
82+
mock_get.assert_called_once_with("https://www.sim.ai/api/workflows/test-workflow-id/status")
8383

8484

8585
def test_simstudio_error():
@@ -131,7 +131,7 @@ def test_async_execution_returns_run_id(mock_post):
131131
mock_response.json.return_value = {
132132
"data": {
133133
"runId": "execution-123",
134-
"statusUrl": "https://sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
134+
"statusUrl": "https://www.sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
135135
}
136136
}
137137
mock_response.headers.get.return_value = None
@@ -146,11 +146,11 @@ def test_async_execution_returns_run_id(mock_post):
146146

147147
assert result.success is True
148148
assert result.run_id == "execution-123"
149-
assert result.status_url == "https://sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
149+
assert result.status_url == "https://www.sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
150150
assert result.async_execution is True
151151

152152
call_args = mock_post.call_args
153-
assert call_args.args[0] == "https://sim.ai/api/v2/workflows/workflow-id/execute"
153+
assert call_args.args[0] == "https://www.sim.ai/api/v2/workflows/workflow-id/execute"
154154
assert "X-Execution-Mode" not in call_args.kwargs["headers"]
155155
assert call_args.kwargs["json"] == {
156156
"input": {"message": "Hello"},

‎packages/ts-sdk/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { SimStudioClient } from 'simstudio-ts-sdk';
3434
// Initialize the client
3535
const client = new SimStudioClient({
3636
apiKey: 'your-api-key-here',
37-
baseUrl: 'https://sim.ai' // optional, defaults to https://sim.ai
37+
baseUrl: 'https://www.sim.ai' // optional, defaults to https://www.sim.ai
3838
});
3939

4040
// Execute a workflow
@@ -57,7 +57,7 @@ new SimStudioClient(config: SimStudioConfig)
5757
```
5858

5959
- `config.apiKey` (string): Your Sim API key
60-
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://sim.ai`)
60+
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`)
6161

6262
#### Methods
6363

‎packages/ts-sdk/examples/basic-usage.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { SimStudioClient, SimStudioError } from '../src/index'
44
async function basicExample() {
55
const client = new SimStudioClient({
66
apiKey: process.env.SIM_API_KEY!,
7-
baseUrl: 'https://sim.ai',
7+
baseUrl: 'https://www.sim.ai',
88
})
99

1010
try {

‎packages/ts-sdk/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simstudio-ts-sdk",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Sim SDK - Execute workflows programmatically",
55
"type": "module",
66
"exports": {

0 commit comments

Comments
 (0)