OpenAICompatibleOptions
Namespace: Vercel.AI.OpenAICompatible
public class OpenAICompatibleOptionsSettings for an OpenAI Chat Completions compatible provider.
Inheritance: object
Derived: AssemblyAIOptions, BasetenOptions, DeepgramOptions, ElevenLabsOptions, GladiaOptions, HumeOptions, KlingAIOptions, OpenAIOptions, RevAIOptions
Properties
Section titled “Properties”AdditionalApiKeyEnvironmentVariables
Section titled “AdditionalApiKeyEnvironmentVariables”public string[] AdditionalApiKeyEnvironmentVariables { get; set; }Extra environment variables accepted as a fallback.
Value: string[]
ApiKey
Section titled “ApiKey”public string? ApiKey { get; set; }Explicit API key. Wins over the environment variable.
Value: string
ApiKeyEnvironmentVariable
Section titled “ApiKeyEnvironmentVariable”public string ApiKeyEnvironmentVariable { get; set; }Environment variable read when ApiKey is empty.
Value: string
ApiKeyHeaderName
Section titled “ApiKeyHeaderName”public string ApiKeyHeaderName { get; set; }Header name for ApiKeyHeader and CustomHeader.
Value: string
ApiKeyStyle
Section titled “ApiKeyStyle”public ApiKeyStyle ApiKeyStyle { get; set; }How to send the key.
Value: ApiKeyStyle
AzureApiVersion
Section titled “AzureApiVersion”public string? AzureApiVersion { get; set; }When set, chat, completion, embedding, and Responses URLs use the Azure routes and this API version.
Value: string
AzureUseDeploymentBasedUrls
Section titled “AzureUseDeploymentBasedUrls”public bool AzureUseDeploymentBasedUrls { get; set; }With AzureApiVersion, uses /openai/deployments/{id} routes instead of /openai/v1.
Value: bool
BaseUrl
Section titled “BaseUrl”public string BaseUrl { get; set; }API origin, without a trailing slash. Chat calls append ChatCompletionsPath.
Value: string
ChatCompletionsPath
Section titled “ChatCompletionsPath”public string ChatCompletionsPath { get; set; }Relative chat path.
Value: string
CompletionsPath
Section titled “CompletionsPath”public string CompletionsPath { get; set; }Relative completions path.
Value: string
ConvertUsage
Section titled “ConvertUsage”public Func<JsonElement, LanguageModelUsage>? ConvertUsage { get; set; }Converts the raw chat usage object. Null uses JsonElement%7d).
Value: Func<JsonElement, LanguageModelUsage>
DownloadHttpClient
Section titled “DownloadHttpClient”public HttpClient? DownloadHttpClient { get; set; }Client for hops off the provider origin when a URL from a response body is downloaded (Fal, Replicate, Luma, Prodia). It must not follow redirects: each hop is validated before it is requested. Null uses a shared client that does not follow them.
Value: HttpClient
EmbeddingsPath
Section titled “EmbeddingsPath”public string EmbeddingsPath { get; set; }Relative embeddings path.
Value: string
Headers
Section titled “Headers”public Dictionary<string, string> Headers { get; }Extra headers sent on every call. These override the API key header.
Value: Dictionary<string, string>
ImageBaseUrl
Section titled “ImageBaseUrl”public string? ImageBaseUrl { get; set; }Origin for image calls when it differs from BaseUrl.
Value: string
ImagesPath
Section titled “ImagesPath”public string ImagesPath { get; set; }Relative images path.
Value: string
IncludeUsage
Section titled “IncludeUsage”public bool IncludeUsage { get; set; }When true, streaming requests send stream_options.include_usage.
Value: bool
JsonTextOverridesToolCalls
Section titled “JsonTextOverridesToolCalls”public bool JsonTextOverridesToolCalls { get; set; }When true, a JSON-mode response that has text drops its tool calls, and a tool_calls finish becomes stop.
Value: bool
MapFinishReason
Section titled “MapFinishReason”public Func<string?, FinishReason?>? MapFinishReason { get; set; }Maps a raw finish reason before the shared mapping. Null falls through.
Value: Func<string, FinishReason?>
MaxEmbeddingsPerCall
Section titled “MaxEmbeddingsPerCall”public int MaxEmbeddingsPerCall { get; set; }Maximum embedding inputs in one request.
Value: int
ProviderName
Section titled “ProviderName”public string ProviderName { get; set; }Provider id recorded on models.
Value: string
QueryParameters
Section titled “QueryParameters”public Dictionary<string, string> QueryParameters { get; }Query parameters appended to every request URL.
Value: Dictionary<string, string>
RequireApiKey
Section titled “RequireApiKey”public bool RequireApiKey { get; set; }When true, a missing API key fails the call. The generic provider leaves this unset.
Value: bool
RerankPath
Section titled “RerankPath”public string RerankPath { get; set; }Relative rerank path.
Value: string
ResolveReasoningEffort
Section titled “ResolveReasoningEffort”public Func<string, string?, string?, IList<CallWarning>, string?>? ResolveReasoningEffort { get; set; }Resolves reasoning_effort for a model. Arguments are the model id, the portable Reasoning level,
the provider option effort, and the call warnings. Null removes the field. Null here keeps the default behavior.
Value: Func<string, string, string, IList<CallWarning>, string>
SelectErrorMessage
Section titled “SelectErrorMessage”public Func<string?, string?>? SelectErrorMessage { get; set; }Rewrites a provider error body into the exception message.
Value: Func<string, string>
SupportsEmbeddings
Section titled “SupportsEmbeddings”public bool SupportsEmbeddings { get; set; }Whether embedding calls are supported.
Value: bool
SupportsImages
Section titled “SupportsImages”public bool SupportsImages { get; set; }Whether ImageModel(string) is supported.
Value: bool
SupportsMultiPartToolContent
Section titled “SupportsMultiPartToolContent”public bool SupportsMultiPartToolContent { get; set; }When true, a tool result with OutputContent is sent as an array of content parts. Otherwise the parts are sent as a JSON string.
Value: bool
SupportsStructuredOutputs
Section titled “SupportsStructuredOutputs”public bool SupportsStructuredOutputs { get; set; }When true, a JSON schema is sent as json_schema instead of json_object.
Value: bool
TransformRequestBody
Section titled “TransformRequestBody”public Func<JsonObject, IList<CallWarning>, JsonObject>? TransformRequestBody { get; set; }Rewrites the JSON body before it is sent. Warnings raised here are returned with the call.
Value: Func<JsonObject, IList<CallWarning>, JsonObject>
UserAgent
Section titled “UserAgent”public string? UserAgent { get; set; }User-agent suffix. Empty uses UserAgent(string).
Value: string
Methods
Section titled “Methods”Copy()
Section titled “Copy()”public OpenAICompatibleOptions Copy()Returns a copy. Providers change the copy, so the options the caller passed in are left as they were.
Returns: OpenAICompatibleOptions
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product