mycode-sdk 0.9.3__tar.gz → 0.9.4__tar.gz

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.
Files changed (23) hide show
  1. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/PKG-INFO +1 -1
  2. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/pyproject.toml +1 -1
  3. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/messages.py +13 -22
  4. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/models_catalog.json +112 -112
  5. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/providers/anthropic_like.py +6 -15
  6. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/providers/base.py +15 -0
  7. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/providers/openai_chat.py +4 -11
  8. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/providers/openai_responses.py +4 -10
  9. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/.gitignore +0 -0
  10. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/LICENSE +0 -0
  11. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/README.md +0 -0
  12. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/__init__.py +0 -0
  13. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/agent.py +0 -0
  14. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/attachments.py +0 -0
  15. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/compact.py +0 -0
  16. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/hooks.py +0 -0
  17. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/models.py +0 -0
  18. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/providers/__init__.py +0 -0
  19. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/providers/gemini.py +0 -0
  20. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/py.typed +0 -0
  21. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/session.py +0 -0
  22. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/tools.py +0 -0
  23. {mycode_sdk-0.9.3 → mycode_sdk-0.9.4}/src/mycode/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mycode-sdk
3
- Version: 0.9.3
3
+ Version: 0.9.4
4
4
  Summary: Lightweight Python SDK for building AI agents.
5
5
  Project-URL: Homepage, https://github.com/legibet/mycode
6
6
  Project-URL: Repository, https://github.com/legibet/mycode
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mycode-sdk"
7
- version = "0.9.3"
7
+ version = "0.9.4"
8
8
  description = "Lightweight Python SDK for building AI agents."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -25,18 +25,20 @@ ContentBlock = dict[str, Any]
25
25
  ConversationMessage = dict[str, Any]
26
26
 
27
27
 
28
- def text_block(text: str, *, meta: dict[str, Any] | None = None) -> ContentBlock:
29
- block: ContentBlock = {"type": "text", "text": text}
28
+ def _set_meta(block: dict[str, Any], meta: dict[str, Any] | None) -> dict[str, Any]:
29
+ """Attach a copy of ``meta`` under the shared ``meta`` key, if non-empty."""
30
+
30
31
  if meta:
31
32
  block["meta"] = dict(meta)
32
33
  return block
33
34
 
34
35
 
36
+ def text_block(text: str, *, meta: dict[str, Any] | None = None) -> ContentBlock:
37
+ return _set_meta({"type": "text", "text": text}, meta)
38
+
39
+
35
40
  def thinking_block(text: str, *, meta: dict[str, Any] | None = None) -> ContentBlock:
36
- block: ContentBlock = {"type": "thinking", "text": text}
37
- if meta:
38
- block["meta"] = dict(meta)
39
- return block
41
+ return _set_meta({"type": "thinking", "text": text}, meta)
40
42
 
41
43
 
42
44
  def image_block(
@@ -49,9 +51,7 @@ def image_block(
49
51
  block: ContentBlock = {"type": "image", "data": data, "mime_type": mime_type}
50
52
  if name:
51
53
  block["name"] = name
52
- if meta:
53
- block["meta"] = dict(meta)
54
- return block
54
+ return _set_meta(block, meta)
55
55
 
56
56
 
57
57
  def document_block(
@@ -64,9 +64,7 @@ def document_block(
64
64
  block: ContentBlock = {"type": "document", "data": data, "mime_type": mime_type}
65
65
  if name:
66
66
  block["name"] = name
67
- if meta:
68
- block["meta"] = dict(meta)
69
- return block
67
+ return _set_meta(block, meta)
70
68
 
71
69
 
72
70
  def tool_use_block(
@@ -82,9 +80,7 @@ def tool_use_block(
82
80
  "name": name,
83
81
  "input": dict(input or {}),
84
82
  }
85
- if meta:
86
- block["meta"] = dict(meta)
87
- return block
83
+ return _set_meta(block, meta)
88
84
 
89
85
 
90
86
  def tool_result_block(
@@ -114,9 +110,7 @@ def tool_result_block(
114
110
  block["metadata"] = dict(metadata)
115
111
  if content:
116
112
  block["content"] = [dict(item) for item in content]
117
- if meta:
118
- block["meta"] = dict(meta)
119
- return block
113
+ return _set_meta(block, meta)
120
114
 
121
115
 
122
116
  def user_text_message(text: str, *, meta: dict[str, Any] | None = None) -> ConversationMessage:
@@ -129,10 +123,7 @@ def build_message(
129
123
  *,
130
124
  meta: dict[str, Any] | None = None,
131
125
  ) -> ConversationMessage:
132
- message: ConversationMessage = {"role": role, "content": blocks}
133
- if meta:
134
- message["meta"] = dict(meta)
135
- return message
126
+ return _set_meta({"role": role, "content": blocks}, meta)
136
127
 
137
128
 
138
129
  def assistant_message(
@@ -1,19 +1,5 @@
1
1
  {
2
2
  "anthropic": {
3
- "claude-3-5-haiku-20241022": {
4
- "context_window": 200000,
5
- "max_output_tokens": 8192,
6
- "supports_image_input": true,
7
- "supports_pdf_input": true,
8
- "supports_reasoning": false
9
- },
10
- "claude-3-5-haiku-latest": {
11
- "context_window": 200000,
12
- "max_output_tokens": 8192,
13
- "supports_image_input": true,
14
- "supports_pdf_input": true,
15
- "supports_reasoning": false
16
- },
17
3
  "claude-3-5-sonnet-20240620": {
18
4
  "context_window": 200000,
19
5
  "max_output_tokens": 8192,
@@ -174,6 +160,13 @@
174
160
  "supports_image_input": true,
175
161
  "supports_pdf_input": true,
176
162
  "supports_reasoning": true
163
+ },
164
+ "claude-sonnet-5": {
165
+ "context_window": 1000000,
166
+ "max_output_tokens": 128000,
167
+ "supports_image_input": true,
168
+ "supports_pdf_input": true,
169
+ "supports_reasoning": true
177
170
  }
178
171
  },
179
172
  "deepseek": {
@@ -360,20 +353,6 @@
360
353
  "supports_image_input": true,
361
354
  "supports_pdf_input": false,
362
355
  "supports_reasoning": true
363
- },
364
- "gemma-4-E2B-it": {
365
- "context_window": 131072,
366
- "max_output_tokens": 8192,
367
- "supports_image_input": true,
368
- "supports_pdf_input": false,
369
- "supports_reasoning": true
370
- },
371
- "gemma-4-E4B-it": {
372
- "context_window": 131072,
373
- "max_output_tokens": 8192,
374
- "supports_image_input": true,
375
- "supports_pdf_input": false,
376
- "supports_reasoning": true
377
356
  }
378
357
  },
379
358
  "minimax": {
@@ -420,7 +399,7 @@
420
399
  "supports_reasoning": true
421
400
  },
422
401
  "MiniMax-M3": {
423
- "context_window": 512000,
402
+ "context_window": 1000000,
424
403
  "max_output_tokens": 128000,
425
404
  "supports_image_input": true,
426
405
  "supports_pdf_input": false,
@@ -766,6 +745,13 @@
766
745
  "supports_pdf_input": false,
767
746
  "supports_reasoning": false
768
747
  },
748
+ "gpt-image-2": {
749
+ "context_window": 0,
750
+ "max_output_tokens": 0,
751
+ "supports_image_input": true,
752
+ "supports_pdf_input": false,
753
+ "supports_reasoning": false
754
+ },
769
755
  "o1": {
770
756
  "context_window": 200000,
771
757
  "max_output_tokens": 100000,
@@ -936,13 +922,6 @@
936
922
  "supports_pdf_input": false,
937
923
  "supports_reasoning": false
938
924
  },
939
- "anthropic/claude-3.5-haiku": {
940
- "context_window": 200000,
941
- "max_output_tokens": 8192,
942
- "supports_image_input": true,
943
- "supports_pdf_input": false,
944
- "supports_reasoning": false
945
- },
946
925
  "anthropic/claude-haiku-4.5": {
947
926
  "context_window": 200000,
948
927
  "max_output_tokens": 64000,
@@ -978,13 +957,6 @@
978
957
  "supports_pdf_input": true,
979
958
  "supports_reasoning": true
980
959
  },
981
- "anthropic/claude-opus-4.6-fast": {
982
- "context_window": 1000000,
983
- "max_output_tokens": 128000,
984
- "supports_image_input": true,
985
- "supports_pdf_input": true,
986
- "supports_reasoning": true
987
- },
988
960
  "anthropic/claude-opus-4.7": {
989
961
  "context_window": 1000000,
990
962
  "max_output_tokens": 128000,
@@ -1034,6 +1006,13 @@
1034
1006
  "supports_pdf_input": true,
1035
1007
  "supports_reasoning": true
1036
1008
  },
1009
+ "anthropic/claude-sonnet-5": {
1010
+ "context_window": 1000000,
1011
+ "max_output_tokens": 128000,
1012
+ "supports_image_input": true,
1013
+ "supports_pdf_input": true,
1014
+ "supports_reasoning": true
1015
+ },
1037
1016
  "arcee-ai/coder-large": {
1038
1017
  "context_window": 32768,
1039
1018
  "max_output_tokens": 32768,
@@ -1043,7 +1022,7 @@
1043
1022
  },
1044
1023
  "arcee-ai/trinity-large-thinking": {
1045
1024
  "context_window": 262144,
1046
- "max_output_tokens": 262144,
1025
+ "max_output_tokens": 80000,
1047
1026
  "supports_image_input": false,
1048
1027
  "supports_pdf_input": false,
1049
1028
  "supports_reasoning": true
@@ -1139,6 +1118,13 @@
1139
1118
  "supports_pdf_input": false,
1140
1119
  "supports_reasoning": false
1141
1120
  },
1121
+ "cohere/north-mini-code:free": {
1122
+ "context_window": 256000,
1123
+ "max_output_tokens": 64000,
1124
+ "supports_image_input": false,
1125
+ "supports_pdf_input": false,
1126
+ "supports_reasoning": true
1127
+ },
1142
1128
  "deepcogito/cogito-v2.1-671b": {
1143
1129
  "context_window": 128000,
1144
1130
  "max_output_tokens": 128000,
@@ -1223,13 +1209,6 @@
1223
1209
  "supports_pdf_input": false,
1224
1210
  "supports_reasoning": true
1225
1211
  },
1226
- "essentialai/rnj-1-instruct": {
1227
- "context_window": 32768,
1228
- "max_output_tokens": 32768,
1229
- "supports_image_input": false,
1230
- "supports_pdf_input": false,
1231
- "supports_reasoning": false
1232
- },
1233
1212
  "google/gemini-2.5-flash": {
1234
1213
  "context_window": 1048576,
1235
1214
  "max_output_tokens": 65535,
@@ -1281,11 +1260,18 @@
1281
1260
  },
1282
1261
  "google/gemini-3-flash-preview": {
1283
1262
  "context_window": 1048576,
1284
- "max_output_tokens": 65536,
1263
+ "max_output_tokens": 65535,
1285
1264
  "supports_image_input": true,
1286
1265
  "supports_pdf_input": true,
1287
1266
  "supports_reasoning": true
1288
1267
  },
1268
+ "google/gemini-3-pro-image": {
1269
+ "context_window": 65536,
1270
+ "max_output_tokens": 32768,
1271
+ "supports_image_input": true,
1272
+ "supports_pdf_input": false,
1273
+ "supports_reasoning": true
1274
+ },
1289
1275
  "google/gemini-3-pro-image-preview": {
1290
1276
  "context_window": 65536,
1291
1277
  "max_output_tokens": 32768,
@@ -1293,9 +1279,16 @@
1293
1279
  "supports_pdf_input": false,
1294
1280
  "supports_reasoning": true
1295
1281
  },
1282
+ "google/gemini-3.1-flash-image": {
1283
+ "context_window": 131072,
1284
+ "max_output_tokens": 32768,
1285
+ "supports_image_input": true,
1286
+ "supports_pdf_input": false,
1287
+ "supports_reasoning": true
1288
+ },
1296
1289
  "google/gemini-3.1-flash-image-preview": {
1297
- "context_window": 65536,
1298
- "max_output_tokens": 65536,
1290
+ "context_window": 131072,
1291
+ "max_output_tokens": 32768,
1299
1292
  "supports_image_input": true,
1300
1293
  "supports_pdf_input": false,
1301
1294
  "supports_reasoning": true
@@ -1307,6 +1300,13 @@
1307
1300
  "supports_pdf_input": true,
1308
1301
  "supports_reasoning": true
1309
1302
  },
1303
+ "google/gemini-3.1-flash-lite-image": {
1304
+ "context_window": 65536,
1305
+ "max_output_tokens": 66000,
1306
+ "supports_image_input": true,
1307
+ "supports_pdf_input": false,
1308
+ "supports_reasoning": true
1309
+ },
1310
1310
  "google/gemini-3.1-flash-lite-preview": {
1311
1311
  "context_window": 1048576,
1312
1312
  "max_output_tokens": 65536,
@@ -1378,7 +1378,7 @@
1378
1378
  "supports_reasoning": true
1379
1379
  },
1380
1380
  "google/gemma-4-26b-a4b-it:free": {
1381
- "context_window": 262144,
1381
+ "context_window": 131072,
1382
1382
  "max_output_tokens": 32768,
1383
1383
  "supports_image_input": true,
1384
1384
  "supports_pdf_input": false,
@@ -1393,7 +1393,7 @@
1393
1393
  },
1394
1394
  "google/gemma-4-31b-it:free": {
1395
1395
  "context_window": 262144,
1396
- "max_output_tokens": 32768,
1396
+ "max_output_tokens": 8192,
1397
1397
  "supports_image_input": true,
1398
1398
  "supports_pdf_input": false,
1399
1399
  "supports_reasoning": true
@@ -1510,13 +1510,6 @@
1510
1510
  "supports_pdf_input": false,
1511
1511
  "supports_reasoning": false
1512
1512
  },
1513
- "meta-llama/llama-3-70b-instruct": {
1514
- "context_window": 8192,
1515
- "max_output_tokens": 8000,
1516
- "supports_image_input": false,
1517
- "supports_pdf_input": false,
1518
- "supports_reasoning": false
1519
- },
1520
1513
  "meta-llama/llama-3-8b-instruct": {
1521
1514
  "context_window": 8192,
1522
1515
  "max_output_tokens": 8192,
@@ -1608,13 +1601,6 @@
1608
1601
  "supports_pdf_input": false,
1609
1602
  "supports_reasoning": false
1610
1603
  },
1611
- "microsoft/phi-4-mini-instruct": {
1612
- "context_window": 128000,
1613
- "max_output_tokens": 128000,
1614
- "supports_image_input": false,
1615
- "supports_pdf_input": false,
1616
- "supports_reasoning": false
1617
- },
1618
1604
  "microsoft/wizardlm-2-8x22b": {
1619
1605
  "context_window": 65535,
1620
1606
  "max_output_tokens": 8000,
@@ -1666,7 +1652,7 @@
1666
1652
  },
1667
1653
  "minimax/minimax-m2.7": {
1668
1654
  "context_window": 196608,
1669
- "max_output_tokens": 131072,
1655
+ "max_output_tokens": 196608,
1670
1656
  "supports_image_input": false,
1671
1657
  "supports_pdf_input": false,
1672
1658
  "supports_reasoning": true
@@ -1813,14 +1799,14 @@
1813
1799
  },
1814
1800
  "moonshotai/kimi-k2": {
1815
1801
  "context_window": 131072,
1816
- "max_output_tokens": 32768,
1802
+ "max_output_tokens": 100352,
1817
1803
  "supports_image_input": false,
1818
1804
  "supports_pdf_input": false,
1819
1805
  "supports_reasoning": false
1820
1806
  },
1821
1807
  "moonshotai/kimi-k2-0905": {
1822
1808
  "context_window": 262144,
1823
- "max_output_tokens": 262144,
1809
+ "max_output_tokens": 100352,
1824
1810
  "supports_image_input": false,
1825
1811
  "supports_pdf_input": false,
1826
1812
  "supports_reasoning": false
@@ -1834,21 +1820,21 @@
1834
1820
  },
1835
1821
  "moonshotai/kimi-k2.5": {
1836
1822
  "context_window": 256000,
1837
- "max_output_tokens": 262144,
1823
+ "max_output_tokens": 256000,
1838
1824
  "supports_image_input": true,
1839
1825
  "supports_pdf_input": false,
1840
1826
  "supports_reasoning": true
1841
1827
  },
1842
1828
  "moonshotai/kimi-k2.6": {
1843
- "context_window": 262142,
1844
- "max_output_tokens": 262142,
1829
+ "context_window": 262144,
1830
+ "max_output_tokens": 262144,
1845
1831
  "supports_image_input": true,
1846
1832
  "supports_pdf_input": false,
1847
1833
  "supports_reasoning": true
1848
1834
  },
1849
1835
  "moonshotai/kimi-k2.7-code": {
1850
1836
  "context_window": 262144,
1851
- "max_output_tokens": 262144,
1837
+ "max_output_tokens": 16384,
1852
1838
  "supports_image_input": true,
1853
1839
  "supports_pdf_input": false,
1854
1840
  "supports_reasoning": true
@@ -1867,7 +1853,7 @@
1867
1853
  "supports_pdf_input": false,
1868
1854
  "supports_reasoning": false
1869
1855
  },
1870
- "nex-agi/nex-n2-pro:free": {
1856
+ "nex-agi/nex-n2-pro": {
1871
1857
  "context_window": 262144,
1872
1858
  "max_output_tokens": 262144,
1873
1859
  "supports_image_input": true,
@@ -1939,7 +1925,7 @@
1939
1925
  },
1940
1926
  "nvidia/nemotron-3-super-120b-a12b": {
1941
1927
  "context_window": 262144,
1942
- "max_output_tokens": 262144,
1928
+ "max_output_tokens": 16384,
1943
1929
  "supports_image_input": false,
1944
1930
  "supports_pdf_input": false,
1945
1931
  "supports_reasoning": true
@@ -2317,7 +2303,7 @@
2317
2303
  },
2318
2304
  "openai/gpt-oss-120b": {
2319
2305
  "context_window": 131072,
2320
- "max_output_tokens": 32768,
2306
+ "max_output_tokens": 131072,
2321
2307
  "supports_image_input": false,
2322
2308
  "supports_pdf_input": false,
2323
2309
  "supports_reasoning": true
@@ -2338,7 +2324,7 @@
2338
2324
  },
2339
2325
  "openai/gpt-oss-20b:free": {
2340
2326
  "context_window": 131072,
2341
- "max_output_tokens": 8192,
2327
+ "max_output_tokens": 32768,
2342
2328
  "supports_image_input": false,
2343
2329
  "supports_pdf_input": false,
2344
2330
  "supports_reasoning": true
@@ -2448,13 +2434,6 @@
2448
2434
  "supports_pdf_input": false,
2449
2435
  "supports_reasoning": false
2450
2436
  },
2451
- "openrouter/owl-alpha": {
2452
- "context_window": 1048756,
2453
- "max_output_tokens": 262144,
2454
- "supports_image_input": false,
2455
- "supports_pdf_input": false,
2456
- "supports_reasoning": false
2457
- },
2458
2437
  "openrouter/pareto-code": {
2459
2438
  "context_window": 2000000,
2460
2439
  "max_output_tokens": 200000,
@@ -2504,6 +2483,13 @@
2504
2483
  "supports_pdf_input": false,
2505
2484
  "supports_reasoning": true
2506
2485
  },
2486
+ "poolside/laguna-m.1": {
2487
+ "context_window": 262144,
2488
+ "max_output_tokens": 32768,
2489
+ "supports_image_input": false,
2490
+ "supports_pdf_input": false,
2491
+ "supports_reasoning": true
2492
+ },
2507
2493
  "poolside/laguna-m.1:free": {
2508
2494
  "context_window": 262144,
2509
2495
  "max_output_tokens": 32768,
@@ -2511,16 +2497,16 @@
2511
2497
  "supports_pdf_input": false,
2512
2498
  "supports_reasoning": true
2513
2499
  },
2514
- "poolside/laguna-xs.2:free": {
2500
+ "poolside/laguna-xs.2": {
2515
2501
  "context_window": 262144,
2516
2502
  "max_output_tokens": 32768,
2517
2503
  "supports_image_input": false,
2518
2504
  "supports_pdf_input": false,
2519
2505
  "supports_reasoning": true
2520
2506
  },
2521
- "prime-intellect/intellect-3": {
2522
- "context_window": 131072,
2523
- "max_output_tokens": 131072,
2507
+ "poolside/laguna-xs.2:free": {
2508
+ "context_window": 262144,
2509
+ "max_output_tokens": 32768,
2524
2510
  "supports_image_input": false,
2525
2511
  "supports_pdf_input": false,
2526
2512
  "supports_reasoning": true
@@ -2596,7 +2582,7 @@
2596
2582
  "supports_reasoning": false
2597
2583
  },
2598
2584
  "qwen/qwen3-235b-a22b-thinking-2507": {
2599
- "context_window": 262144,
2585
+ "context_window": 131072,
2600
2586
  "max_output_tokens": 262144,
2601
2587
  "supports_image_input": false,
2602
2588
  "supports_pdf_input": false,
@@ -2786,7 +2772,7 @@
2786
2772
  },
2787
2773
  "qwen/qwen3.5-397b-a17b": {
2788
2774
  "context_window": 131072,
2789
- "max_output_tokens": 65536,
2775
+ "max_output_tokens": 64000,
2790
2776
  "supports_image_input": true,
2791
2777
  "supports_pdf_input": false,
2792
2778
  "supports_reasoning": true
@@ -2896,6 +2882,13 @@
2896
2882
  "supports_pdf_input": false,
2897
2883
  "supports_reasoning": false
2898
2884
  },
2885
+ "sakana/fugu-ultra": {
2886
+ "context_window": 1000000,
2887
+ "max_output_tokens": 128000,
2888
+ "supports_image_input": true,
2889
+ "supports_pdf_input": false,
2890
+ "supports_reasoning": true
2891
+ },
2899
2892
  "sao10k/l3-lunaris-8b": {
2900
2893
  "context_window": 8192,
2901
2894
  "max_output_tokens": 16384,
@@ -2926,7 +2919,7 @@
2926
2919
  },
2927
2920
  "stepfun/step-3.5-flash": {
2928
2921
  "context_window": 262144,
2929
- "max_output_tokens": 16384,
2922
+ "max_output_tokens": 65536,
2930
2923
  "supports_image_input": false,
2931
2924
  "supports_pdf_input": false,
2932
2925
  "supports_reasoning": true
@@ -3026,7 +3019,7 @@
3026
3019
  "context_window": 1000000,
3027
3020
  "max_output_tokens": 1000000,
3028
3021
  "supports_image_input": true,
3029
- "supports_pdf_input": false,
3022
+ "supports_pdf_input": true,
3030
3023
  "supports_reasoning": true
3031
3024
  },
3032
3025
  "x-ai/grok-build-0.1": {
@@ -3036,15 +3029,8 @@
3036
3029
  "supports_pdf_input": false,
3037
3030
  "supports_reasoning": true
3038
3031
  },
3039
- "xiaomi/mimo-v2-flash": {
3040
- "context_window": 262144,
3041
- "max_output_tokens": 65536,
3042
- "supports_image_input": false,
3043
- "supports_pdf_input": false,
3044
- "supports_reasoning": true
3045
- },
3046
3032
  "xiaomi/mimo-v2.5": {
3047
- "context_window": 1048576,
3033
+ "context_window": 32000,
3048
3034
  "max_output_tokens": 131072,
3049
3035
  "supports_image_input": true,
3050
3036
  "supports_pdf_input": false,
@@ -3065,8 +3051,8 @@
3065
3051
  "supports_reasoning": true
3066
3052
  },
3067
3053
  "z-ai/glm-4.5-air": {
3068
- "context_window": 131070,
3069
- "max_output_tokens": 131070,
3054
+ "context_window": 131072,
3055
+ "max_output_tokens": 98304,
3070
3056
  "supports_image_input": false,
3071
3057
  "supports_pdf_input": false,
3072
3058
  "supports_reasoning": true
@@ -3108,7 +3094,7 @@
3108
3094
  },
3109
3095
  "z-ai/glm-5": {
3110
3096
  "context_window": 202752,
3111
- "max_output_tokens": 16384,
3097
+ "max_output_tokens": 128000,
3112
3098
  "supports_image_input": false,
3113
3099
  "supports_pdf_input": false,
3114
3100
  "supports_reasoning": true
@@ -3121,19 +3107,26 @@
3121
3107
  "supports_reasoning": true
3122
3108
  },
3123
3109
  "z-ai/glm-5.1": {
3124
- "context_window": 202752,
3125
- "max_output_tokens": 131072,
3110
+ "context_window": 65536,
3111
+ "max_output_tokens": 128000,
3126
3112
  "supports_image_input": false,
3127
3113
  "supports_pdf_input": false,
3128
3114
  "supports_reasoning": true
3129
3115
  },
3130
3116
  "z-ai/glm-5.2": {
3131
3117
  "context_window": 1048576,
3132
- "max_output_tokens": 131072,
3118
+ "max_output_tokens": 32768,
3133
3119
  "supports_image_input": false,
3134
3120
  "supports_pdf_input": false,
3135
3121
  "supports_reasoning": true
3136
3122
  },
3123
+ "z-ai/glm-5v-turbo": {
3124
+ "context_window": 202752,
3125
+ "max_output_tokens": 131072,
3126
+ "supports_image_input": true,
3127
+ "supports_pdf_input": false,
3128
+ "supports_reasoning": true
3129
+ },
3137
3130
  "~anthropic/claude-fable-latest": {
3138
3131
  "context_window": 1000000,
3139
3132
  "max_output_tokens": 128000,
@@ -3177,8 +3170,8 @@
3177
3170
  "supports_reasoning": true
3178
3171
  },
3179
3172
  "~moonshotai/kimi-latest": {
3180
- "context_window": 262142,
3181
- "max_output_tokens": 262142,
3173
+ "context_window": 262144,
3174
+ "max_output_tokens": 262144,
3182
3175
  "supports_image_input": true,
3183
3176
  "supports_pdf_input": false,
3184
3177
  "supports_reasoning": true
@@ -3283,6 +3276,13 @@
3283
3276
  "supports_pdf_input": false,
3284
3277
  "supports_reasoning": true
3285
3278
  },
3279
+ "glm-5.2": {
3280
+ "context_window": 1000000,
3281
+ "max_output_tokens": 131072,
3282
+ "supports_image_input": false,
3283
+ "supports_pdf_input": false,
3284
+ "supports_reasoning": true
3285
+ },
3286
3286
  "glm-5v-turbo": {
3287
3287
  "context_window": 200000,
3288
3288
  "max_output_tokens": 131072,
@@ -185,16 +185,11 @@ class AnthropicLikeAdapter(ProviderAdapter):
185
185
  continue
186
186
 
187
187
  if block_type == "tool_use":
188
- native_meta = {}
189
- caller = getattr(block, "caller", None)
190
- if caller is not None:
191
- native_meta["caller"] = caller
192
188
  blocks.append(
193
189
  tool_use_block(
194
190
  tool_id=getattr(block, "id", ""),
195
191
  name=getattr(block, "name", ""),
196
192
  input=getattr(block, "input", None),
197
- meta=native_block_meta(native_meta),
198
193
  )
199
194
  )
200
195
  continue
@@ -270,16 +265,12 @@ class AnthropicLikeAdapter(ProviderAdapter):
270
265
  return payload
271
266
 
272
267
  if block_type == "tool_use":
273
- native_meta = get_native_meta(block)
274
- payload = {
268
+ return {
275
269
  "type": "tool_use",
276
270
  "id": block.get("id"),
277
271
  "name": block.get("name"),
278
272
  "input": block.get("input") if isinstance(block.get("input"), dict) else {},
279
273
  }
280
- if native_meta.get("caller") is not None:
281
- payload["caller"] = native_meta["caller"]
282
- return payload
283
274
 
284
275
  if block_type == "image":
285
276
  mime_type, data = load_image_block_payload(block)
@@ -321,7 +312,7 @@ class AnthropicAdapter(AnthropicLikeAdapter):
321
312
  label = "Anthropic"
322
313
  default_base_url = "https://api.anthropic.com"
323
314
  env_api_key_names = ("ANTHROPIC_API_KEY",)
324
- default_models = ("claude-sonnet-4-6", "claude-opus-4-8")
315
+ default_models = ("claude-sonnet-5", "claude-opus-4-8")
325
316
  supports_reasoning_effort = True
326
317
 
327
318
  @override
@@ -347,14 +338,14 @@ class AnthropicAdapter(AnthropicLikeAdapter):
347
338
  if normalized.startswith(("claude-opus-4-7", "claude-opus-4-8")):
348
339
  return {"effort": effort}
349
340
 
350
- if normalized.startswith("claude-sonnet-4-6"):
351
- mapped_effort = "high" if effort == "xhigh" else effort
352
- return {"effort": mapped_effort}
353
-
354
341
  if normalized.startswith("claude-opus-4-6"):
355
342
  mapped_effort = "max" if effort == "xhigh" else effort
356
343
  return {"effort": mapped_effort}
357
344
 
345
+ if normalized.startswith(("claude-sonnet-4-6", "claude-sonnet-5")):
346
+ mapped_effort = "high" if effort == "xhigh" else effort
347
+ return {"effort": mapped_effort}
348
+
358
349
  return None
359
350
 
360
351
 
@@ -16,6 +16,7 @@ from typing import Any
16
16
  from mycode.attachments import unsupported_attachment_block
17
17
  from mycode.compact import apply_compact_replay
18
18
  from mycode.messages import ConversationMessage, build_message, text_block, tool_result_block
19
+ from mycode.utils import parse_tool_arguments
19
20
 
20
21
  DEFAULT_REQUEST_TIMEOUT = 300.0
21
22
 
@@ -74,6 +75,20 @@ def native_block_meta(native: dict[str, Any]) -> dict[str, Any] | None:
74
75
  return {"native": native} if native else None
75
76
 
76
77
 
78
+ def parse_tool_call_input(raw_arguments: str) -> tuple[dict[str, Any], dict[str, Any]]:
79
+ """Parse a streamed/native tool-call JSON arguments string.
80
+
81
+ Returns ``(input, extra_native_fields)``. On parse failure, ``input`` is
82
+ empty and ``extra_native_fields`` preserves the raw text under
83
+ ``raw_arguments`` so it stays inspectable in ``block.meta.native``.
84
+ """
85
+
86
+ parsed = parse_tool_arguments(raw_arguments)
87
+ if parsed is None:
88
+ return {}, {"raw_arguments": raw_arguments}
89
+ return parsed, {}
90
+
91
+
77
92
  class ProviderAdapter(ABC):
78
93
  """Base class for provider adapters.
79
94
 
@@ -20,8 +20,9 @@ from mycode.providers.base import (
20
20
  load_document_block_payload,
21
21
  load_image_block_payload,
22
22
  native_block_meta,
23
+ parse_tool_call_input,
23
24
  )
24
- from mycode.utils import omit_none, parse_tool_arguments
25
+ from mycode.utils import omit_none
25
26
 
26
27
 
27
28
  @dataclass
@@ -118,21 +119,13 @@ class OpenAIChatAdapter(ProviderAdapter):
118
119
 
119
120
  for index in sorted(tool_calls):
120
121
  state = tool_calls[index]
121
- raw_arguments = state.arguments_text
122
- parsed_arguments = parse_tool_arguments(raw_arguments)
123
- if parsed_arguments is None:
124
- tool_input = {}
125
- meta = {"native": {"raw_arguments": raw_arguments}}
126
- else:
127
- tool_input = parsed_arguments
128
- meta = None
129
-
122
+ tool_input, extra_native = parse_tool_call_input(state.arguments_text)
130
123
  blocks.append(
131
124
  tool_use_block(
132
125
  tool_id=state.tool_id or f"tool_call_{index}",
133
126
  name=state.name,
134
127
  input=tool_input,
135
- meta=meta,
128
+ meta=native_block_meta(extra_native),
136
129
  )
137
130
  )
138
131
 
@@ -19,9 +19,10 @@ from mycode.providers.base import (
19
19
  load_document_block_payload,
20
20
  load_image_block_payload,
21
21
  native_block_meta,
22
+ parse_tool_call_input,
22
23
  tool_result_content_blocks,
23
24
  )
24
- from mycode.utils import omit_none, parse_tool_arguments
25
+ from mycode.utils import omit_none
25
26
 
26
27
 
27
28
  class OpenAIResponsesAdapter(ProviderAdapter):
@@ -308,19 +309,12 @@ class OpenAIResponsesAdapter(ProviderAdapter):
308
309
  continue
309
310
 
310
311
  if item_type == "function_call":
311
- raw_arguments = getattr(item, "arguments", "") or ""
312
- parsed_arguments = parse_tool_arguments(raw_arguments)
313
- if parsed_arguments is None:
314
- tool_input = {}
315
- raw_args_entry: dict[str, Any] = {"raw_arguments": raw_arguments}
316
- else:
317
- tool_input = parsed_arguments
318
- raw_args_entry = {}
312
+ tool_input, extra_native = parse_tool_call_input(getattr(item, "arguments", "") or "")
319
313
  item_meta = omit_none(
320
314
  {
321
315
  "item_id": getattr(item, "id", None),
322
316
  "status": getattr(item, "status", None),
323
- **raw_args_entry,
317
+ **extra_native,
324
318
  }
325
319
  )
326
320
  blocks.append(
File without changes
File without changes
File without changes