fix(ai): forward Anthropic provider options (#38694)

This commit is contained in:
Shoubhit Dash 2026-07-24 18:50:20 +05:30 committed by GitHub
commit c06186a9d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 2 deletions

View file

@ -3,7 +3,7 @@ import { AnthropicMessages } from "../protocols/anthropic-messages"
import { Auth } from "../route/auth"
import type { ProviderAuthOption } from "../route/auth-options"
import type { RouteDefaultsInput } from "../route/client"
import { ProviderID, type ModelID } from "../schema"
import { ProviderID, type ModelID, type ProviderOptions } from "../schema"
export const id = ProviderID.make("anthropic-compatible")
@ -20,6 +20,7 @@ export type Settings = ProviderPackage.Settings &
) & {
readonly baseURL: string
readonly provider?: string
readonly providerOptions?: ProviderOptions
}
export const routes = [AnthropicMessages.route]
@ -61,6 +62,7 @@ export const model: ProviderPackage.Definition<Settings>["model"] = (modelID, se
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
limits: settings.limits,
provider: settings.provider,
providerOptions: settings.providerOptions,
}).model(modelID)
}

View file

@ -2,7 +2,7 @@ import type { RouteDefaultsInput } from "../route/client"
import { Auth } from "../route/auth"
import type { ProviderAuthOption } from "../route/auth-options"
import type { ProviderPackage } from "../provider-package"
import { ProviderID, type ModelID } from "../schema"
import { ProviderID, type ModelID, type ProviderOptions } from "../schema"
import { AnthropicMessages } from "../protocols/anthropic-messages"
import { AnthropicCompatible } from "./anthropic-compatible"
@ -18,6 +18,7 @@ export type Settings = ProviderPackage.Settings &
| { readonly apiKey?: never; readonly authToken?: string }
) & {
readonly baseURL?: string
readonly providerOptions?: ProviderOptions
}
const auth = (options: ProviderAuthOption<"optional">) => {
@ -52,5 +53,6 @@ export const model: ProviderPackage.Definition<Settings>["model"] = (modelID, se
headers: settings.headers === undefined ? undefined : { ...settings.headers },
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
limits: settings.limits,
providerOptions: settings.providerOptions,
}).model(modelID)
}