[BREAKGLASS] One interface, every AI model. A Swift SDK to interface with AI providers. http://tachikoma.build
Go to file
2026-04-28 01:54:45 +01:00
.github/workflows ci: drop parallel swift test 2026-01-18 08:09:58 +00:00
assets Complete Tachikoma Swift Package with logo header 2025-08-02 22:49:53 +02:00
docs fix(auth): align provider env aliases 2026-03-13 13:10:20 +00:00
Examples style: run swiftformat 2026-03-13 20:19:11 +00:00
scripts chore: add core coverage helper 2025-11-13 03:08:44 +00:00
Sources fix: stabilize concurrent audio batch tests 2026-04-27 08:53:54 +01:00
Tests chore: release 0.2.0 2026-04-28 01:54:45 +01:00
.gitignore Remove .DS_Store files and update .gitignore 2025-08-03 14:46:44 +02:00
.swiftformat chore: sync updates 2025-11-18 10:46:42 +01:00
.swiftlint.yml chore: fix lint and format 2025-11-17 21:20:37 +01:00
AGENTS.md docs: note grouped git ops 2026-03-13 18:38:14 +00:00
CHANGELOG.md chore: release 0.2.0 2026-04-28 01:54:45 +01:00
CLAUDE.md Rename CLAUDE.md to AGENTS.md 2025-11-07 02:55:40 +00:00
CONTRIBUTING.md docs(readme): simplify and move advanced content 2025-12-18 08:48:29 +01:00
LICENSE build: update swift dependencies and fix license 2026-04-27 11:29:07 +01:00
Package.resolved build: update swift dependencies and fix license 2026-04-27 11:29:07 +01:00
Package.swift fix: support swift-sdk 0.12 MCP content 2026-03-28 04:11:24 +00:00
README.md docs(readme): link documentation entries 2025-12-18 09:00:59 +01:00
test-grok-stream-tools.swift style: run swiftformat 2026-03-13 20:19:11 +00:00
test-grok-tachikoma.swift style: run swiftformat 2026-03-13 20:19:11 +00:00
test-grok-tools.swift refactor: normalize model parsing and reformat sources 2025-11-05 12:24:37 +00:00
test-grok.swift refactor: normalize model parsing and reformat sources 2025-11-05 12:24:37 +00:00
test-output.log Align providers with GPT-5/o4 model lineup 2025-11-06 21:03:23 +00:00

Tachikoma Logo

Tachikoma — Swift AI SDK

Swift 6.0+ Platforms MIT License CI Status

Modern, Swift-native APIs for text, vision, tools, and realtime voice.

Install

Swift Package Manager:

.package(url: "https://github.com/steipete/Tachikoma.git", branch: "main"),
.product(name: "Tachikoma", package: "Tachikoma"),

Quick Start

import Tachikoma

let text = try await generate("Write a haiku about Swift.", using: .anthropic(.opus45))
print(text)

Streaming

import Tachikoma

let stream = try await stream("Explain actors in Swift.", using: .openai(.gpt52))
for try await delta in stream {
    print(delta.content ?? "", terminator: "")
}

Conversation

import Tachikoma

let conversation = Conversation()
conversation.addUserMessage("You are a concise assistant.")
conversation.addUserMessage("Summarize Swift concurrency in 3 bullets.")
let reply = try await conversation.continue(using: .anthropic(.opus45))
print(reply)

Vision

import Tachikoma

let pngData: Data = /* ... */
let image = ImageInput(data: pngData, mimeType: "image/png")
let answer = try await analyze(image: image, prompt: "Whats in this image?", using: .openai(.gpt4o))
print(answer)

Tools (function calling)

import Tachikoma

let tool = createTool(
    name: "add",
    description: "Add two integers",
    parameters: [
        .init(name: "a", type: .integer, description: "First"),
        .init(name: "b", type: .integer, description: "Second"),
    ]
) { args in
    let a = try args.intValue("a")
    let b = try args.intValue("b")
    return ["sum": a + b]
}

let result = try await generateText(
    model: .openai(.gpt52),
    messages: [.user("Compute 123 + 456 using the add tool.")],
    tools: [tool],
    maxSteps: 3
)
print(result.text)

Models

Common picks:

  • Anthropic: claude-opus-4-5 (LanguageModel.default)
  • OpenAI: gpt-5.2 (flagship), gpt-5 (coding/agents), o4-mini (reasoning), gpt-4o (vision)
  • Google: gemini-3-flash
  • Grok: grok-4-fast-reasoning
  • Local: ollama/llama3.3

Full catalog (including enum case names + provider notes): docs/models.md.

Credentials

Set API keys via env vars (or use TKAuthManager):

  • OpenAI: OPENAI_API_KEY
  • Anthropic: ANTHROPIC_API_KEY
  • Gemini: GEMINI_API_KEY (alias: GOOGLE_API_KEY)
  • Grok: X_AI_API_KEY (aliases: XAI_API_KEY, GROK_API_KEY)

Hosts can change the credential storage root:

  • TachikomaConfiguration.profileDirectoryName (Peekaboo uses .peekaboo)

Documentation

License

MIT. See LICENSE.