Cerebras

Use Cerebras inference models through a dedicated Swift model type.

CerebrasModel reads CEREBRAS_API_KEY and targets https://api.cerebras.ai/v1.

let model = CerebrasModel("gpt-oss-120b")
let result = try await generateText(model: model, prompt: "Say hello.")
print(result.text)

The initializer accepts optional apiKey:, baseURL:, headers:, and urlSession: overrides. Tools, structured output, vision, and reasoning are encoded when requested and depend on the selected model.

Models

Model IDStatus
gpt-oss-120bProduction
gemma-4-31bPreview
zai-glm-4.7Preview

Preview availability can change. Check Cerebras's model overview or query the authenticated GET https://api.cerebras.ai/v1/models endpoint.

On this page