MistralAPI

1.0.0

Swift client for the Mistral AI API, generated from the official OpenAPI specification
atacan/MistralAPI

What's New

1.0.0

2026-02-28T14:23:27Z

Initial public release.

MistralAPI

A Swift client for the Mistral AI API, generated from the official OpenAPI specification using Swift OpenAPI Generator.

Requirements

  • Swift 6.1+
  • macOS 14+ / iOS 17+ / tvOS 17+

Installation

Add the dependency to your Package.swift:

dependencies: [
    .package(url: "https://github.com/atacan/MistralAPI", from: "0.1.0"),
]

Then add the target dependency. There are three library products to choose from:

Library Transport Use case
MistralAPI AsyncHTTPClient Server-side Swift
MistralAPIUrlSessionClient URLSession Apple platforms
MistralAPITypes None Types only (shared models)
.target(
    name: "MyApp",
    dependencies: [
        .product(name: "MistralAPI", package: "MistralAPI"),
    ]
),

Usage

import MistralAPI
import MistralAPITypes

let client = try createClient(apiKey: "your-api-key")

// Audio transcription
let audioData: Data = // ... load your audio file
let response = try await client.audio_api_v1_transcriptions_post(
    body: .multipartForm([
        .model(.init(payload: .init(body: HTTPBody(MistralModelID.Transcription.voxtralMiniLatest)))),
        .file(.init(payload: .init(body: HTTPBody(audioData)), filename: "audio.mp3")),
    ])
)

How It Works

The client code is generated from Mistral's OpenAPI specification (openapi.yaml), with fixes applied via an OpenAPI Overlay (overlay.json). The generated Swift types and client code live in GeneratedSources/ directories.

License

MIT

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Mon Jul 13 2026 13:27:40 GMT-0900 (Hawaii-Aleutian Daylight Time)