openapi.json 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. {
  2. "openapi": "3.1.0",
  3. "info": {
  4. "title": "opencode",
  5. "description": "opencode api",
  6. "version": "1.0.0"
  7. },
  8. "paths": {
  9. "/session_create": {
  10. "post": {
  11. "responses": {
  12. "200": {
  13. "description": "Successfully created session",
  14. "content": {
  15. "application/json": {
  16. "schema": {
  17. "$ref": "#/components/schemas/Session.Info"
  18. }
  19. }
  20. }
  21. }
  22. },
  23. "operationId": "postSession_create",
  24. "parameters": [],
  25. "description": "Create a new session"
  26. }
  27. },
  28. "/session_share": {
  29. "post": {
  30. "responses": {
  31. "200": {
  32. "description": "Successfully shared session",
  33. "content": {
  34. "application/json": {
  35. "schema": {
  36. "$ref": "#/components/schemas/Session.Info"
  37. }
  38. }
  39. }
  40. }
  41. },
  42. "operationId": "postSession_share",
  43. "parameters": [],
  44. "description": "Share the session",
  45. "requestBody": {
  46. "content": {
  47. "application/json": {
  48. "schema": {
  49. "type": "object",
  50. "properties": {
  51. "sessionID": {
  52. "type": "string"
  53. }
  54. },
  55. "required": [
  56. "sessionID"
  57. ]
  58. }
  59. }
  60. }
  61. }
  62. }
  63. },
  64. "/session_messages": {
  65. "post": {
  66. "responses": {
  67. "200": {
  68. "description": "Successfully created session",
  69. "content": {
  70. "application/json": {
  71. "schema": {}
  72. }
  73. }
  74. }
  75. },
  76. "operationId": "postSession_messages",
  77. "parameters": [],
  78. "description": "Get messages for a session",
  79. "requestBody": {
  80. "content": {
  81. "application/json": {
  82. "schema": {
  83. "type": "object",
  84. "properties": {
  85. "sessionID": {
  86. "type": "string"
  87. }
  88. },
  89. "required": [
  90. "sessionID"
  91. ]
  92. }
  93. }
  94. }
  95. }
  96. }
  97. },
  98. "/session_list": {
  99. "post": {
  100. "responses": {
  101. "200": {
  102. "description": "List of sessions",
  103. "content": {
  104. "application/json": {
  105. "schema": {
  106. "type": "array",
  107. "items": {
  108. "type": "object",
  109. "properties": {
  110. "id": {
  111. "type": "string",
  112. "pattern": "^ses"
  113. },
  114. "shareID": {
  115. "type": "string"
  116. },
  117. "title": {
  118. "type": "string"
  119. },
  120. "tokens": {
  121. "type": "object",
  122. "properties": {
  123. "input": {
  124. "type": "number"
  125. },
  126. "output": {
  127. "type": "number"
  128. },
  129. "reasoning": {
  130. "type": "number"
  131. }
  132. },
  133. "required": [
  134. "input",
  135. "output",
  136. "reasoning"
  137. ]
  138. }
  139. },
  140. "required": [
  141. "id",
  142. "title",
  143. "tokens"
  144. ]
  145. }
  146. }
  147. }
  148. }
  149. }
  150. },
  151. "operationId": "postSession_list",
  152. "parameters": [],
  153. "description": "List all sessions"
  154. }
  155. },
  156. "/session_chat": {
  157. "post": {
  158. "responses": {},
  159. "operationId": "postSession_chat",
  160. "parameters": [],
  161. "requestBody": {
  162. "content": {
  163. "application/json": {
  164. "schema": {
  165. "type": "object",
  166. "properties": {
  167. "sessionID": {
  168. "type": "string"
  169. },
  170. "providerID": {
  171. "type": "string"
  172. },
  173. "modelID": {
  174. "type": "string"
  175. },
  176. "parts": {}
  177. },
  178. "required": [
  179. "sessionID",
  180. "providerID",
  181. "modelID"
  182. ]
  183. }
  184. }
  185. }
  186. }
  187. }
  188. },
  189. "/provider_list": {
  190. "post": {
  191. "responses": {
  192. "200": {
  193. "description": "List of providers",
  194. "content": {
  195. "application/json": {
  196. "schema": {
  197. "type": "object",
  198. "additionalProperties": {
  199. "$ref": "#/components/schemas/Provider.Info"
  200. }
  201. }
  202. }
  203. }
  204. }
  205. },
  206. "operationId": "postProvider_list",
  207. "parameters": [],
  208. "description": "List all providers"
  209. }
  210. }
  211. },
  212. "components": {
  213. "schemas": {
  214. "Session.Info": {
  215. "type": "object",
  216. "properties": {
  217. "id": {
  218. "type": "string",
  219. "pattern": "^ses"
  220. },
  221. "shareID": {
  222. "type": "string"
  223. },
  224. "title": {
  225. "type": "string"
  226. },
  227. "tokens": {
  228. "type": "object",
  229. "properties": {
  230. "input": {
  231. "type": "number"
  232. },
  233. "output": {
  234. "type": "number"
  235. },
  236. "reasoning": {
  237. "type": "number"
  238. }
  239. },
  240. "required": [
  241. "input",
  242. "output",
  243. "reasoning"
  244. ]
  245. }
  246. },
  247. "required": [
  248. "id",
  249. "title",
  250. "tokens"
  251. ]
  252. },
  253. "Provider.Info": {
  254. "type": "object",
  255. "properties": {
  256. "options": {
  257. "type": "object",
  258. "additionalProperties": {}
  259. },
  260. "models": {
  261. "type": "object",
  262. "additionalProperties": {
  263. "type": "object",
  264. "properties": {
  265. "name": {
  266. "type": "string"
  267. },
  268. "cost": {
  269. "type": "object",
  270. "properties": {
  271. "input": {
  272. "type": "number"
  273. },
  274. "inputCached": {
  275. "type": "number"
  276. },
  277. "output": {
  278. "type": "number"
  279. },
  280. "outputCached": {
  281. "type": "number"
  282. }
  283. },
  284. "required": [
  285. "input",
  286. "inputCached",
  287. "output",
  288. "outputCached"
  289. ]
  290. },
  291. "contextWindow": {
  292. "type": "number"
  293. },
  294. "maxTokens": {
  295. "type": "number"
  296. },
  297. "attachment": {
  298. "type": "boolean"
  299. }
  300. },
  301. "required": [
  302. "cost",
  303. "contextWindow",
  304. "maxTokens",
  305. "attachment"
  306. ]
  307. }
  308. }
  309. }
  310. }
  311. }
  312. }
  313. }