summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/pkg
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-06-05 14:59:07 -0400
committerDax Raad <[email protected]>2025-06-05 14:59:16 -0400
commitdb2bb32bcf0c3fdc8ede5530946e85a852448679 (patch)
tree31f81b89cd8ed7b642a09e25fcb0a2a4b1c0e6bb /packages/tui/pkg
parent1384a5e3e69522001571980f147a5aa0d985f895 (diff)
downloadopencode-db2bb32bcf0c3fdc8ede5530946e85a852448679.tar.gz
opencode-db2bb32bcf0c3fdc8ede5530946e85a852448679.zip
integrate with models.dev
Diffstat (limited to 'packages/tui/pkg')
-rw-r--r--packages/tui/pkg/client/gen/openapi.json66
-rw-r--r--packages/tui/pkg/client/generated-client.go33
2 files changed, 63 insertions, 36 deletions
diff --git a/packages/tui/pkg/client/gen/openapi.json b/packages/tui/pkg/client/gen/openapi.json
index a9f19d4b3..f329b48b3 100644
--- a/packages/tui/pkg/client/gen/openapi.json
+++ b/packages/tui/pkg/client/gen/openapi.json
@@ -401,10 +401,25 @@
"content": {
"application/json": {
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Provider.Info"
- }
+ "type": "object",
+ "properties": {
+ "providers": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Provider.Info"
+ }
+ },
+ "default": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "providers",
+ "default"
+ ]
}
}
}
@@ -1080,13 +1095,9 @@
"name": {
"type": "string"
},
- "options": {
- "type": "object",
- "additionalProperties": {}
- },
"models": {
- "type": "array",
- "items": {
+ "type": "object",
+ "additionalProperties": {
"$ref": "#/components/schemas/Provider.Model"
}
}
@@ -1106,6 +1117,12 @@
"name": {
"type": "string"
},
+ "attachment": {
+ "type": "boolean"
+ },
+ "reasoning": {
+ "type": "boolean"
+ },
"cost": {
"type": "object",
"properties": {
@@ -1129,24 +1146,27 @@
"outputCached"
]
},
- "contextWindow": {
- "type": "number"
- },
- "maxOutputTokens": {
- "type": "number"
- },
- "attachment": {
- "type": "boolean"
- },
- "reasoning": {
- "type": "boolean"
+ "limit": {
+ "type": "object",
+ "properties": {
+ "context": {
+ "type": "number"
+ },
+ "output": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "context",
+ "output"
+ ]
}
},
"required": [
"id",
+ "attachment",
"cost",
- "contextWindow",
- "attachment"
+ "limit"
]
}
}
diff --git a/packages/tui/pkg/client/generated-client.go b/packages/tui/pkg/client/generated-client.go
index 1237685a9..247af33a7 100644
--- a/packages/tui/pkg/client/generated-client.go
+++ b/packages/tui/pkg/client/generated-client.go
@@ -203,26 +203,27 @@ type MessageToolInvocationToolResult struct {
// ProviderInfo defines model for Provider.Info.
type ProviderInfo struct {
- Id string `json:"id"`
- Models []ProviderModel `json:"models"`
- Name string `json:"name"`
- Options *map[string]interface{} `json:"options,omitempty"`
+ Id string `json:"id"`
+ Models map[string]ProviderModel `json:"models"`
+ Name string `json:"name"`
}
// ProviderModel defines model for Provider.Model.
type ProviderModel struct {
- Attachment bool `json:"attachment"`
- ContextWindow float32 `json:"contextWindow"`
- Cost struct {
+ Attachment bool `json:"attachment"`
+ Cost struct {
Input float32 `json:"input"`
InputCached float32 `json:"inputCached"`
Output float32 `json:"output"`
OutputCached float32 `json:"outputCached"`
} `json:"cost"`
- Id string `json:"id"`
- MaxOutputTokens *float32 `json:"maxOutputTokens,omitempty"`
- Name *string `json:"name,omitempty"`
- Reasoning *bool `json:"reasoning,omitempty"`
+ Id string `json:"id"`
+ Limit struct {
+ Context float32 `json:"context"`
+ Output float32 `json:"output"`
+ } `json:"limit"`
+ Name *string `json:"name,omitempty"`
+ Reasoning *bool `json:"reasoning,omitempty"`
}
// PermissionInfo defines model for permission.info.
@@ -1815,7 +1816,10 @@ func (r PostPathGetResponse) StatusCode() int {
type PostProviderListResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON200 *[]ProviderInfo
+ JSON200 *struct {
+ Default map[string]string `json:"default"`
+ Providers []ProviderInfo `json:"providers"`
+ }
}
// Status returns HTTPResponse.Status
@@ -2299,7 +2303,10 @@ func ParsePostProviderListResponse(rsp *http.Response) (*PostProviderListRespons
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest []ProviderInfo
+ var dest struct {
+ Default map[string]string `json:"default"`
+ Providers []ProviderInfo `json:"providers"`
+ }
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}