mycode-sdk 0.9.2__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.2 → mycode_sdk-0.9.4}/PKG-INFO +1 -1
  2. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/pyproject.toml +1 -1
  3. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/messages.py +13 -22
  4. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/models_catalog.json +128 -114
  5. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/providers/anthropic_like.py +28 -20
  6. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/providers/base.py +15 -0
  7. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/providers/openai_chat.py +4 -11
  8. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/providers/openai_responses.py +4 -10
  9. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/.gitignore +0 -0
  10. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/LICENSE +0 -0
  11. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/README.md +0 -0
  12. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/__init__.py +0 -0
  13. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/agent.py +0 -0
  14. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/attachments.py +0 -0
  15. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/compact.py +0 -0
  16. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/hooks.py +0 -0
  17. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/models.py +0 -0
  18. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/providers/__init__.py +0 -0
  19. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/providers/gemini.py +0 -0
  20. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/py.typed +0 -0
  21. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/session.py +0 -0
  22. {mycode_sdk-0.9.2 → mycode_sdk-0.9.4}/src/mycode/tools.py +0 -0
  23. {mycode_sdk-0.9.2 → 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.2
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.2"
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": {
@@ -406,7 +399,7 @@
406
399
  "supports_reasoning": true
407
400
  },
408
401
  "MiniMax-M3": {
409
- "context_window": 512000,
402
+ "context_window": 1000000,
410
403
  "max_output_tokens": 128000,
411
404
  "supports_image_input": true,
412
405
  "supports_pdf_input": false,
@@ -469,6 +462,13 @@
469
462
  "supports_image_input": true,
470
463
  "supports_pdf_input": false,
471
464
  "supports_reasoning": true
465
+ },
466
+ "kimi-k2.7-code-highspeed": {
467
+ "context_window": 262144,
468
+ "max_output_tokens": 262144,
469
+ "supports_image_input": true,
470
+ "supports_pdf_input": false,
471
+ "supports_reasoning": true
472
472
  }
473
473
  },
474
474
  "openai": {
@@ -745,6 +745,13 @@
745
745
  "supports_pdf_input": false,
746
746
  "supports_reasoning": false
747
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
+ },
748
755
  "o1": {
749
756
  "context_window": 200000,
750
757
  "max_output_tokens": 100000,
@@ -915,20 +922,6 @@
915
922
  "supports_pdf_input": false,
916
923
  "supports_reasoning": false
917
924
  },
918
- "anthropic/claude-3.5-haiku": {
919
- "context_window": 200000,
920
- "max_output_tokens": 8192,
921
- "supports_image_input": true,
922
- "supports_pdf_input": false,
923
- "supports_reasoning": false
924
- },
925
- "anthropic/claude-fable-5": {
926
- "context_window": 1000000,
927
- "max_output_tokens": 128000,
928
- "supports_image_input": true,
929
- "supports_pdf_input": true,
930
- "supports_reasoning": true
931
- },
932
925
  "anthropic/claude-haiku-4.5": {
933
926
  "context_window": 200000,
934
927
  "max_output_tokens": 64000,
@@ -964,13 +957,6 @@
964
957
  "supports_pdf_input": true,
965
958
  "supports_reasoning": true
966
959
  },
967
- "anthropic/claude-opus-4.6-fast": {
968
- "context_window": 1000000,
969
- "max_output_tokens": 128000,
970
- "supports_image_input": true,
971
- "supports_pdf_input": true,
972
- "supports_reasoning": true
973
- },
974
960
  "anthropic/claude-opus-4.7": {
975
961
  "context_window": 1000000,
976
962
  "max_output_tokens": 128000,
@@ -1020,6 +1006,13 @@
1020
1006
  "supports_pdf_input": true,
1021
1007
  "supports_reasoning": true
1022
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
+ },
1023
1016
  "arcee-ai/coder-large": {
1024
1017
  "context_window": 32768,
1025
1018
  "max_output_tokens": 32768,
@@ -1029,7 +1022,7 @@
1029
1022
  },
1030
1023
  "arcee-ai/trinity-large-thinking": {
1031
1024
  "context_window": 262144,
1032
- "max_output_tokens": 262144,
1025
+ "max_output_tokens": 80000,
1033
1026
  "supports_image_input": false,
1034
1027
  "supports_pdf_input": false,
1035
1028
  "supports_reasoning": true
@@ -1125,6 +1118,13 @@
1125
1118
  "supports_pdf_input": false,
1126
1119
  "supports_reasoning": false
1127
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
+ },
1128
1128
  "deepcogito/cogito-v2.1-671b": {
1129
1129
  "context_window": 128000,
1130
1130
  "max_output_tokens": 128000,
@@ -1174,13 +1174,6 @@
1174
1174
  "supports_pdf_input": false,
1175
1175
  "supports_reasoning": true
1176
1176
  },
1177
- "deepseek/deepseek-r1-distill-qwen-32b": {
1178
- "context_window": 32768,
1179
- "max_output_tokens": 32768,
1180
- "supports_image_input": false,
1181
- "supports_pdf_input": false,
1182
- "supports_reasoning": true
1183
- },
1184
1177
  "deepseek/deepseek-v3.1-terminus": {
1185
1178
  "context_window": 163840,
1186
1179
  "max_output_tokens": 32768,
@@ -1204,7 +1197,7 @@
1204
1197
  },
1205
1198
  "deepseek/deepseek-v4-flash": {
1206
1199
  "context_window": 1048575,
1207
- "max_output_tokens": 131072,
1200
+ "max_output_tokens": 65536,
1208
1201
  "supports_image_input": false,
1209
1202
  "supports_pdf_input": false,
1210
1203
  "supports_reasoning": true
@@ -1216,13 +1209,6 @@
1216
1209
  "supports_pdf_input": false,
1217
1210
  "supports_reasoning": true
1218
1211
  },
1219
- "essentialai/rnj-1-instruct": {
1220
- "context_window": 32768,
1221
- "max_output_tokens": 32768,
1222
- "supports_image_input": false,
1223
- "supports_pdf_input": false,
1224
- "supports_reasoning": false
1225
- },
1226
1212
  "google/gemini-2.5-flash": {
1227
1213
  "context_window": 1048576,
1228
1214
  "max_output_tokens": 65535,
@@ -1274,11 +1260,18 @@
1274
1260
  },
1275
1261
  "google/gemini-3-flash-preview": {
1276
1262
  "context_window": 1048576,
1277
- "max_output_tokens": 65536,
1263
+ "max_output_tokens": 65535,
1278
1264
  "supports_image_input": true,
1279
1265
  "supports_pdf_input": true,
1280
1266
  "supports_reasoning": true
1281
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
+ },
1282
1275
  "google/gemini-3-pro-image-preview": {
1283
1276
  "context_window": 65536,
1284
1277
  "max_output_tokens": 32768,
@@ -1286,9 +1279,16 @@
1286
1279
  "supports_pdf_input": false,
1287
1280
  "supports_reasoning": true
1288
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
+ },
1289
1289
  "google/gemini-3.1-flash-image-preview": {
1290
- "context_window": 65536,
1291
- "max_output_tokens": 65536,
1290
+ "context_window": 131072,
1291
+ "max_output_tokens": 32768,
1292
1292
  "supports_image_input": true,
1293
1293
  "supports_pdf_input": false,
1294
1294
  "supports_reasoning": true
@@ -1300,6 +1300,13 @@
1300
1300
  "supports_pdf_input": true,
1301
1301
  "supports_reasoning": true
1302
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
+ },
1303
1310
  "google/gemini-3.1-flash-lite-preview": {
1304
1311
  "context_window": 1048576,
1305
1312
  "max_output_tokens": 65536,
@@ -1371,7 +1378,7 @@
1371
1378
  "supports_reasoning": true
1372
1379
  },
1373
1380
  "google/gemma-4-26b-a4b-it:free": {
1374
- "context_window": 262144,
1381
+ "context_window": 131072,
1375
1382
  "max_output_tokens": 32768,
1376
1383
  "supports_image_input": true,
1377
1384
  "supports_pdf_input": false,
@@ -1386,7 +1393,7 @@
1386
1393
  },
1387
1394
  "google/gemma-4-31b-it:free": {
1388
1395
  "context_window": 262144,
1389
- "max_output_tokens": 32768,
1396
+ "max_output_tokens": 8192,
1390
1397
  "supports_image_input": true,
1391
1398
  "supports_pdf_input": false,
1392
1399
  "supports_reasoning": true
@@ -1503,13 +1510,6 @@
1503
1510
  "supports_pdf_input": false,
1504
1511
  "supports_reasoning": false
1505
1512
  },
1506
- "meta-llama/llama-3-70b-instruct": {
1507
- "context_window": 8192,
1508
- "max_output_tokens": 8000,
1509
- "supports_image_input": false,
1510
- "supports_pdf_input": false,
1511
- "supports_reasoning": false
1512
- },
1513
1513
  "meta-llama/llama-3-8b-instruct": {
1514
1514
  "context_window": 8192,
1515
1515
  "max_output_tokens": 8192,
@@ -1601,13 +1601,6 @@
1601
1601
  "supports_pdf_input": false,
1602
1602
  "supports_reasoning": false
1603
1603
  },
1604
- "microsoft/phi-4-mini-instruct": {
1605
- "context_window": 128000,
1606
- "max_output_tokens": 128000,
1607
- "supports_image_input": false,
1608
- "supports_pdf_input": false,
1609
- "supports_reasoning": false
1610
- },
1611
1604
  "microsoft/wizardlm-2-8x22b": {
1612
1605
  "context_window": 65535,
1613
1606
  "max_output_tokens": 8000,
@@ -1659,7 +1652,7 @@
1659
1652
  },
1660
1653
  "minimax/minimax-m2.7": {
1661
1654
  "context_window": 196608,
1662
- "max_output_tokens": 131072,
1655
+ "max_output_tokens": 196608,
1663
1656
  "supports_image_input": false,
1664
1657
  "supports_pdf_input": false,
1665
1658
  "supports_reasoning": true
@@ -1806,14 +1799,14 @@
1806
1799
  },
1807
1800
  "moonshotai/kimi-k2": {
1808
1801
  "context_window": 131072,
1809
- "max_output_tokens": 32768,
1802
+ "max_output_tokens": 100352,
1810
1803
  "supports_image_input": false,
1811
1804
  "supports_pdf_input": false,
1812
1805
  "supports_reasoning": false
1813
1806
  },
1814
1807
  "moonshotai/kimi-k2-0905": {
1815
1808
  "context_window": 262144,
1816
- "max_output_tokens": 262144,
1809
+ "max_output_tokens": 100352,
1817
1810
  "supports_image_input": false,
1818
1811
  "supports_pdf_input": false,
1819
1812
  "supports_reasoning": false
@@ -1827,21 +1820,21 @@
1827
1820
  },
1828
1821
  "moonshotai/kimi-k2.5": {
1829
1822
  "context_window": 256000,
1830
- "max_output_tokens": 262144,
1823
+ "max_output_tokens": 256000,
1831
1824
  "supports_image_input": true,
1832
1825
  "supports_pdf_input": false,
1833
1826
  "supports_reasoning": true
1834
1827
  },
1835
1828
  "moonshotai/kimi-k2.6": {
1836
- "context_window": 262142,
1837
- "max_output_tokens": 262142,
1829
+ "context_window": 262144,
1830
+ "max_output_tokens": 262144,
1838
1831
  "supports_image_input": true,
1839
1832
  "supports_pdf_input": false,
1840
1833
  "supports_reasoning": true
1841
1834
  },
1842
1835
  "moonshotai/kimi-k2.7-code": {
1843
1836
  "context_window": 262144,
1844
- "max_output_tokens": 262144,
1837
+ "max_output_tokens": 16384,
1845
1838
  "supports_image_input": true,
1846
1839
  "supports_pdf_input": false,
1847
1840
  "supports_reasoning": true
@@ -1860,7 +1853,7 @@
1860
1853
  "supports_pdf_input": false,
1861
1854
  "supports_reasoning": false
1862
1855
  },
1863
- "nex-agi/nex-n2-pro:free": {
1856
+ "nex-agi/nex-n2-pro": {
1864
1857
  "context_window": 262144,
1865
1858
  "max_output_tokens": 262144,
1866
1859
  "supports_image_input": true,
@@ -1932,7 +1925,7 @@
1932
1925
  },
1933
1926
  "nvidia/nemotron-3-super-120b-a12b": {
1934
1927
  "context_window": 262144,
1935
- "max_output_tokens": 262144,
1928
+ "max_output_tokens": 16384,
1936
1929
  "supports_image_input": false,
1937
1930
  "supports_pdf_input": false,
1938
1931
  "supports_reasoning": true
@@ -2310,7 +2303,7 @@
2310
2303
  },
2311
2304
  "openai/gpt-oss-120b": {
2312
2305
  "context_window": 131072,
2313
- "max_output_tokens": 32768,
2306
+ "max_output_tokens": 131072,
2314
2307
  "supports_image_input": false,
2315
2308
  "supports_pdf_input": false,
2316
2309
  "supports_reasoning": true
@@ -2331,7 +2324,7 @@
2331
2324
  },
2332
2325
  "openai/gpt-oss-20b:free": {
2333
2326
  "context_window": 131072,
2334
- "max_output_tokens": 8192,
2327
+ "max_output_tokens": 32768,
2335
2328
  "supports_image_input": false,
2336
2329
  "supports_pdf_input": false,
2337
2330
  "supports_reasoning": true
@@ -2435,19 +2428,12 @@
2435
2428
  "supports_reasoning": true
2436
2429
  },
2437
2430
  "openrouter/fusion": {
2438
- "context_window": 128000,
2431
+ "context_window": 1000000,
2439
2432
  "max_output_tokens": 128000,
2440
2433
  "supports_image_input": false,
2441
2434
  "supports_pdf_input": false,
2442
2435
  "supports_reasoning": false
2443
2436
  },
2444
- "openrouter/owl-alpha": {
2445
- "context_window": 1048756,
2446
- "max_output_tokens": 262144,
2447
- "supports_image_input": false,
2448
- "supports_pdf_input": false,
2449
- "supports_reasoning": false
2450
- },
2451
2437
  "openrouter/pareto-code": {
2452
2438
  "context_window": 2000000,
2453
2439
  "max_output_tokens": 200000,
@@ -2497,6 +2483,13 @@
2497
2483
  "supports_pdf_input": false,
2498
2484
  "supports_reasoning": true
2499
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
+ },
2500
2493
  "poolside/laguna-m.1:free": {
2501
2494
  "context_window": 262144,
2502
2495
  "max_output_tokens": 32768,
@@ -2504,16 +2497,16 @@
2504
2497
  "supports_pdf_input": false,
2505
2498
  "supports_reasoning": true
2506
2499
  },
2507
- "poolside/laguna-xs.2:free": {
2500
+ "poolside/laguna-xs.2": {
2508
2501
  "context_window": 262144,
2509
2502
  "max_output_tokens": 32768,
2510
2503
  "supports_image_input": false,
2511
2504
  "supports_pdf_input": false,
2512
2505
  "supports_reasoning": true
2513
2506
  },
2514
- "prime-intellect/intellect-3": {
2515
- "context_window": 131072,
2516
- "max_output_tokens": 131072,
2507
+ "poolside/laguna-xs.2:free": {
2508
+ "context_window": 262144,
2509
+ "max_output_tokens": 32768,
2517
2510
  "supports_image_input": false,
2518
2511
  "supports_pdf_input": false,
2519
2512
  "supports_reasoning": true
@@ -2589,7 +2582,7 @@
2589
2582
  "supports_reasoning": false
2590
2583
  },
2591
2584
  "qwen/qwen3-235b-a22b-thinking-2507": {
2592
- "context_window": 262144,
2585
+ "context_window": 131072,
2593
2586
  "max_output_tokens": 262144,
2594
2587
  "supports_image_input": false,
2595
2588
  "supports_pdf_input": false,
@@ -2772,14 +2765,14 @@
2772
2765
  },
2773
2766
  "qwen/qwen3.5-35b-a3b": {
2774
2767
  "context_window": 262144,
2775
- "max_output_tokens": 262144,
2768
+ "max_output_tokens": 81920,
2776
2769
  "supports_image_input": true,
2777
2770
  "supports_pdf_input": false,
2778
2771
  "supports_reasoning": true
2779
2772
  },
2780
2773
  "qwen/qwen3.5-397b-a17b": {
2781
- "context_window": 262144,
2782
- "max_output_tokens": 65536,
2774
+ "context_window": 131072,
2775
+ "max_output_tokens": 64000,
2783
2776
  "supports_image_input": true,
2784
2777
  "supports_pdf_input": false,
2785
2778
  "supports_reasoning": true
@@ -2889,6 +2882,13 @@
2889
2882
  "supports_pdf_input": false,
2890
2883
  "supports_reasoning": false
2891
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
+ },
2892
2892
  "sao10k/l3-lunaris-8b": {
2893
2893
  "context_window": 8192,
2894
2894
  "max_output_tokens": 16384,
@@ -2919,7 +2919,7 @@
2919
2919
  },
2920
2920
  "stepfun/step-3.5-flash": {
2921
2921
  "context_window": 262144,
2922
- "max_output_tokens": 16384,
2922
+ "max_output_tokens": 65536,
2923
2923
  "supports_image_input": false,
2924
2924
  "supports_pdf_input": false,
2925
2925
  "supports_reasoning": true
@@ -3019,7 +3019,7 @@
3019
3019
  "context_window": 1000000,
3020
3020
  "max_output_tokens": 1000000,
3021
3021
  "supports_image_input": true,
3022
- "supports_pdf_input": false,
3022
+ "supports_pdf_input": true,
3023
3023
  "supports_reasoning": true
3024
3024
  },
3025
3025
  "x-ai/grok-build-0.1": {
@@ -3029,15 +3029,8 @@
3029
3029
  "supports_pdf_input": false,
3030
3030
  "supports_reasoning": true
3031
3031
  },
3032
- "xiaomi/mimo-v2-flash": {
3033
- "context_window": 262144,
3034
- "max_output_tokens": 65536,
3035
- "supports_image_input": false,
3036
- "supports_pdf_input": false,
3037
- "supports_reasoning": true
3038
- },
3039
3032
  "xiaomi/mimo-v2.5": {
3040
- "context_window": 1048576,
3033
+ "context_window": 32000,
3041
3034
  "max_output_tokens": 131072,
3042
3035
  "supports_image_input": true,
3043
3036
  "supports_pdf_input": false,
@@ -3058,8 +3051,8 @@
3058
3051
  "supports_reasoning": true
3059
3052
  },
3060
3053
  "z-ai/glm-4.5-air": {
3061
- "context_window": 131070,
3062
- "max_output_tokens": 131070,
3054
+ "context_window": 131072,
3055
+ "max_output_tokens": 98304,
3063
3056
  "supports_image_input": false,
3064
3057
  "supports_pdf_input": false,
3065
3058
  "supports_reasoning": true
@@ -3101,7 +3094,7 @@
3101
3094
  },
3102
3095
  "z-ai/glm-5": {
3103
3096
  "context_window": 202752,
3104
- "max_output_tokens": 16384,
3097
+ "max_output_tokens": 128000,
3105
3098
  "supports_image_input": false,
3106
3099
  "supports_pdf_input": false,
3107
3100
  "supports_reasoning": true
@@ -3114,9 +3107,23 @@
3114
3107
  "supports_reasoning": true
3115
3108
  },
3116
3109
  "z-ai/glm-5.1": {
3110
+ "context_window": 65536,
3111
+ "max_output_tokens": 128000,
3112
+ "supports_image_input": false,
3113
+ "supports_pdf_input": false,
3114
+ "supports_reasoning": true
3115
+ },
3116
+ "z-ai/glm-5.2": {
3117
+ "context_window": 1048576,
3118
+ "max_output_tokens": 32768,
3119
+ "supports_image_input": false,
3120
+ "supports_pdf_input": false,
3121
+ "supports_reasoning": true
3122
+ },
3123
+ "z-ai/glm-5v-turbo": {
3117
3124
  "context_window": 202752,
3118
3125
  "max_output_tokens": 131072,
3119
- "supports_image_input": false,
3126
+ "supports_image_input": true,
3120
3127
  "supports_pdf_input": false,
3121
3128
  "supports_reasoning": true
3122
3129
  },
@@ -3163,8 +3170,8 @@
3163
3170
  "supports_reasoning": true
3164
3171
  },
3165
3172
  "~moonshotai/kimi-latest": {
3166
- "context_window": 262142,
3167
- "max_output_tokens": 262142,
3173
+ "context_window": 262144,
3174
+ "max_output_tokens": 262144,
3168
3175
  "supports_image_input": true,
3169
3176
  "supports_pdf_input": false,
3170
3177
  "supports_reasoning": true
@@ -3269,6 +3276,13 @@
3269
3276
  "supports_pdf_input": false,
3270
3277
  "supports_reasoning": true
3271
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
+ },
3272
3286
  "glm-5v-turbo": {
3273
3287
  "context_window": 200000,
3274
3288
  "max_output_tokens": 131072,
@@ -41,7 +41,11 @@ class AnthropicLikeAdapter(ProviderAdapter):
41
41
  return None
42
42
 
43
43
  def _build_request_payload(self, request: ProviderRequest) -> dict[str, Any]:
44
- messages = [self._serialize_message(message) for message in self.prepare_messages(request)]
44
+ messages = []
45
+ for replay_message in self.prepare_messages(request):
46
+ message = self._serialize_message(replay_message)
47
+ if message["content"]:
48
+ messages.append(message)
45
49
  self._apply_cache_control(messages)
46
50
  thinking = self.thinking_config(request)
47
51
 
@@ -181,16 +185,11 @@ class AnthropicLikeAdapter(ProviderAdapter):
181
185
  continue
182
186
 
183
187
  if block_type == "tool_use":
184
- native_meta = {}
185
- caller = getattr(block, "caller", None)
186
- if caller is not None:
187
- native_meta["caller"] = caller
188
188
  blocks.append(
189
189
  tool_use_block(
190
190
  tool_id=getattr(block, "id", ""),
191
191
  name=getattr(block, "name", ""),
192
192
  input=getattr(block, "input", None),
193
- meta=native_block_meta(native_meta),
194
193
  )
195
194
  )
196
195
  continue
@@ -229,11 +228,24 @@ class AnthropicLikeAdapter(ProviderAdapter):
229
228
  }
230
229
 
231
230
  def _serialize_message(self, message: ConversationMessage) -> dict[str, Any]:
231
+ role = str(message.get("role") or "user")
232
+ raw_meta = message.get("meta")
233
+ source_provider = raw_meta.get("provider") if isinstance(raw_meta, dict) else None
234
+ content = []
235
+ for block in message.get("content") or []:
236
+ if not isinstance(block, dict):
237
+ continue
238
+ if (
239
+ self.provider_id == "anthropic"
240
+ and role == "assistant"
241
+ and block.get("type") == "thinking"
242
+ and (source_provider != self.provider_id or not get_native_meta(block).get("signature"))
243
+ ):
244
+ continue
245
+ content.append(self._serialize_block(block))
232
246
  return {
233
- "role": str(message.get("role") or "user"),
234
- "content": [
235
- self._serialize_block(block) for block in message.get("content") or [] if isinstance(block, dict)
236
- ],
247
+ "role": role,
248
+ "content": content,
237
249
  }
238
250
 
239
251
  def _serialize_block(self, block: dict[str, Any]) -> dict[str, Any]:
@@ -253,16 +265,12 @@ class AnthropicLikeAdapter(ProviderAdapter):
253
265
  return payload
254
266
 
255
267
  if block_type == "tool_use":
256
- native_meta = get_native_meta(block)
257
- payload = {
268
+ return {
258
269
  "type": "tool_use",
259
270
  "id": block.get("id"),
260
271
  "name": block.get("name"),
261
272
  "input": block.get("input") if isinstance(block.get("input"), dict) else {},
262
273
  }
263
- if native_meta.get("caller") is not None:
264
- payload["caller"] = native_meta["caller"]
265
- return payload
266
274
 
267
275
  if block_type == "image":
268
276
  mime_type, data = load_image_block_payload(block)
@@ -304,7 +312,7 @@ class AnthropicAdapter(AnthropicLikeAdapter):
304
312
  label = "Anthropic"
305
313
  default_base_url = "https://api.anthropic.com"
306
314
  env_api_key_names = ("ANTHROPIC_API_KEY",)
307
- default_models = ("claude-sonnet-4-6", "claude-opus-4-8")
315
+ default_models = ("claude-sonnet-5", "claude-opus-4-8")
308
316
  supports_reasoning_effort = True
309
317
 
310
318
  @override
@@ -330,14 +338,14 @@ class AnthropicAdapter(AnthropicLikeAdapter):
330
338
  if normalized.startswith(("claude-opus-4-7", "claude-opus-4-8")):
331
339
  return {"effort": effort}
332
340
 
333
- if normalized.startswith("claude-sonnet-4-6"):
334
- mapped_effort = "high" if effort == "xhigh" else effort
335
- return {"effort": mapped_effort}
336
-
337
341
  if normalized.startswith("claude-opus-4-6"):
338
342
  mapped_effort = "max" if effort == "xhigh" else effort
339
343
  return {"effort": mapped_effort}
340
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
+
341
349
  return None
342
350
 
343
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