Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/discover-provider-models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@truefoundry/trueforge': minor
---

Add `GET /settings/model-providers/{name}/discovered-models`, which asks a configured provider which models it serves. Gemini's native list reports token limits, so discovered models carry the `context_length` that context compaction relies on; other providers use the OpenAI-compatible list, which reports ids only.
107 changes: 107 additions & 0 deletions .github/fern/openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,30 @@
"properties": {},
"type": "object"
},
"DiscoveredModel": {
"additionalProperties": false,
"properties": {
"context_length": {
"description": "Maximum context window in tokens, when the provider reports one.",
"exclusiveMinimum": 0,
"type": "integer"
},
"max_output_tokens": {
"description": "Maximum output tokens, when the provider reports one.",
"exclusiveMinimum": 0,
"type": "integer"
},
"model_id": {
"description": "Upstream, provider-specific identifier sent to the provider API.",
"minLength": 1,
"type": "string"
}
},
"required": [
"model_id"
],
"type": "object"
},
"DynamicSubAgentsConfig": {
"default": {
"enabled": true
Expand Down Expand Up @@ -1717,6 +1741,20 @@
],
"type": "object"
},
"ListDiscoveredModelsResponse": {
"properties": {
"data": {
"items": {
"$ref": "#/components/schemas/DiscoveredModel"
},
"type": "array"
}
},
"required": [
"data"
],
"type": "object"
},
"ListMCPServerToolsResponse": {
"properties": {
"data": {
Expand Down Expand Up @@ -8530,6 +8568,75 @@
"x-fern-sdk-method-name": "create_or_update"
}
},
"/api/v1/settings/model-providers/{name}/discovered-models": {
"get": {
"description": "Asks the provider itself which models it serves, using the stored API key. Returns token limits when the provider reports them (Gemini does; the OpenAI-compatible list does not). The shipped catalog is a preset list and may lag the provider, so this is the current source of truth.",
"parameters": [
{
"description": "Configured provider resource name, e.g. `google-gemini`.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"description": "Configured provider resource name, e.g. `google-gemini`.",
"minLength": 1,
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListDiscoveredModelsResponse"
}
}
},
"description": "Models the provider reports"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RequestErrorResponse"
}
}
},
"description": "No provider is configured under this name."
},
"501": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RequestErrorResponse"
}
}
},
"description": "This provider type has no discovery adapter."
},
"502": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RequestErrorResponse"
}
}
},
"description": "The provider was unreachable or rejected the request."
}
},
"summary": "List the models a configured provider reports",
"tags": [
"Models"
],
"x-fern-sdk-group-name": [
"settings",
"modelProviders"
],
"x-fern-sdk-method-name": "discovered_models"
}
},
"/api/v1/settings/sandbox-providers": {
"get": {
"description": "The single configured sandbox provider for this tenant. `auth.api_key` is redacted.",
Expand Down
107 changes: 107 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,30 @@
"properties": {},
"type": "object"
},
"DiscoveredModel": {
"additionalProperties": false,
"properties": {
"context_length": {
"description": "Maximum context window in tokens, when the provider reports one.",
"exclusiveMinimum": 0,
"type": "integer"
},
"max_output_tokens": {
"description": "Maximum output tokens, when the provider reports one.",
"exclusiveMinimum": 0,
"type": "integer"
},
"model_id": {
"description": "Upstream, provider-specific identifier sent to the provider API.",
"minLength": 1,
"type": "string"
}
},
"required": [
"model_id"
],
"type": "object"
},
"DynamicSubAgentsConfig": {
"default": {
"enabled": true
Expand Down Expand Up @@ -1717,6 +1741,20 @@
],
"type": "object"
},
"ListDiscoveredModelsResponse": {
"properties": {
"data": {
"items": {
"$ref": "#/components/schemas/DiscoveredModel"
},
"type": "array"
}
},
"required": [
"data"
],
"type": "object"
},
"ListMCPServerToolsResponse": {
"properties": {
"data": {
Expand Down Expand Up @@ -8530,6 +8568,75 @@
"x-fern-sdk-method-name": "create_or_update"
}
},
"/api/v1/settings/model-providers/{name}/discovered-models": {
"get": {
"description": "Asks the provider itself which models it serves, using the stored API key. Returns token limits when the provider reports them (Gemini does; the OpenAI-compatible list does not). The shipped catalog is a preset list and may lag the provider, so this is the current source of truth.",
"parameters": [
{
"description": "Configured provider resource name, e.g. `google-gemini`.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"description": "Configured provider resource name, e.g. `google-gemini`.",
"minLength": 1,
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListDiscoveredModelsResponse"
}
}
},
"description": "Models the provider reports"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RequestErrorResponse"
}
}
},
"description": "No provider is configured under this name."
},
"501": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RequestErrorResponse"
}
}
},
"description": "This provider type has no discovery adapter."
},
"502": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RequestErrorResponse"
}
}
},
"description": "The provider was unreachable or rejected the request."
}
},
"summary": "List the models a configured provider reports",
"tags": [
"Models"
],
"x-fern-sdk-group-name": [
"settings",
"modelProviders"
],
"x-fern-sdk-method-name": "discovered_models"
}
},
"/api/v1/settings/sandbox-providers": {
"get": {
"description": "The single configured sandbox provider for this tenant. `auth.api_key` is redacted.",
Expand Down
63 changes: 63 additions & 0 deletions packages/trueforge-sdk/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3302,6 +3302,69 @@ await client.settings.modelProviders.createOrUpdate({
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.settings.modelProviders.<a href="/src/api/resources/settings/resources/modelProviders/client/Client.ts">discoveredModels</a>(name) -> TrueForge.ListDiscoveredModelsResponse</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Asks the provider itself which models it serves, using the stored API key. Returns token limits when the provider reports them (Gemini does; the OpenAI-compatible list does not). The shipped catalog is a preset list and may lag the provider, so this is the current source of truth.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.settings.modelProviders.discoveredModels("name");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**name:** `string` — Configured provider resource name, e.g. `google-gemini`.

</dd>
</dl>

<dl>
<dd>

**requestOptions:** `ModelProvidersClient.RequestOptions`

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down
24 changes: 24 additions & 0 deletions packages/trueforge-sdk/src/api/errors/NotImplementedError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This file was auto-generated by Fern from our API Definition.

import type * as core from "../../core/index.js";
import * as errors from "../../errors/index.js";
import type * as TrueForge from "../index.js";

export class NotImplementedError extends errors.TrueForgeError {
public declare readonly body: TrueForge.RequestErrorResponse;

constructor(body: TrueForge.RequestErrorResponse, rawResponse?: core.RawResponse) {
super({
message: "NotImplementedError",
statusCode: 501,
body: body,
rawResponse: rawResponse,
});
Object.setPrototypeOf(this, new.target.prototype);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}

this.name = "NotImplementedError";
}
}
1 change: 1 addition & 0 deletions packages/trueforge-sdk/src/api/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from "./ForbiddenError.js";
export * from "./GoneError.js";
export * from "./InternalServerError.js";
export * from "./NotFoundError.js";
export * from "./NotImplementedError.js";
export * from "./PreconditionFailedError.js";
export * from "./UnauthorizedError.js";
export * from "./UnprocessableEntityError.js";
Loading