Skip to content

OpenAICompatibleTransforms

Namespace: Vercel.AI.OpenAICompatible

public static class OpenAICompatibleTransforms

Request-body transforms used by thin OpenAI-compatible providers.

Inheritance: object

View source

public static string? BasetenError(string? body)

Reads a Baseten error. The Model APIs send error as a string; dedicated deployments send an object with a message.

Parameters

Name Type Description
body string

Returns: string

View source

public static JsonObject Cerebras(JsonObject body, IList<CallWarning> warnings)

Maps Cerebras field names and assistant reasoning_content onto reasoning.

Parameters

Name Type Description
body JsonObject
warnings IList<CallWarning>

Returns: JsonObject

View source

public static string? CerebrasError(string? body)

Reads a Cerebras error message from the top-level message field.

Parameters

Name Type Description
body string

Returns: string

View source

public static JsonObject Fireworks(JsonObject body, IList<CallWarning> warnings)

Maps Fireworks thinking, cache, service tier, and reasoning effort. Fireworks supports low, medium, and high.

Parameters

Name Type Description
body JsonObject
warnings IList<CallWarning>

Returns: JsonObject

View source

public static string? GmiCloudError(string? body)

Reads a GMI Cloud error, preferring the diagnostic nested in error.details.

Parameters

Name Type Description
body string

Returns: string

View source

public static JsonObject Groq(JsonObject body, IList<CallWarning> warnings)

Maps Groq reasoning levels. none is kept only for qwen/qwen3.6-27b. minimal becomes low and xhigh and max become high.

Parameters

Name Type Description
body JsonObject
warnings IList<CallWarning>

Returns: JsonObject

View source

public static JsonObject Zai(JsonObject body, IList<CallWarning> warnings)

Drops fields Z.AI does not accept and renames its provider options.

Parameters

Name Type Description
body JsonObject
warnings IList<CallWarning>

Returns: JsonObject

View source

public static string? ZaiError(string? body)

Reads a Z.AI error from error.message or a top-level message.

Parameters

Name Type Description
body string

Returns: string

View source

public static FinishReason? ZaiFinish(string? raw)

Maps a Z.AI finish reason. Unrecognized values fall through.

Parameters

Name Type Description
raw string

Returns: FinishReason?

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product