[BREAKGLASS] One interface, every AI model. A Swift SDK to interface with AI providers.
http://tachikoma.build
* feat: add Claude Fable 5 support * style: satisfy Tachikoma CI lint * ci: serialize Linux Swift tests |
||
|---|---|---|
| .github/workflows | ||
| assets | ||
| docs | ||
| Examples | ||
| scripts | ||
| Sources | ||
| Tests | ||
| .gitignore | ||
| .swiftformat | ||
| .swiftlint.yml | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| Package.resolved | ||
| Package.swift | ||
| README.md | ||
| test-grok-stream-tools.swift | ||
| test-grok-tachikoma.swift | ||
| test-grok-tools.swift | ||
| test-grok.swift | ||
| test-output.log | ||
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(.gpt54))
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: "What’s in this image?", using: .openai(.gpt55))
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(.gpt54),
messages: [.user("Compute 123 + 456 using the add tool.")],
tools: [tool],
maxSteps: 3
)
print(result.text)
Models
Common picks:
- Anthropic:
claude-opus-4-8(LanguageModel.default, non-streaming),claude-fable-5(explicit opt-in) - OpenAI:
gpt-5.5(LanguageModel.defaultStreaming),gpt-5.4/gpt-5.4-mini/gpt-5.4-nano,gpt-5 - Google:
gemini-3.1-pro-preview,gemini-3-flash - Grok:
grok-4.3 - 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
- Model catalog:
docs/models.md - Modern API overview:
docs/modern-api.md - Realtime voice + Harmony patterns:
docs/openai-harmony.md - Architecture:
docs/ARCHITECTURE.md - Local models:
docs/lmstudio.md,docs/gpt-oss.md - Azure notes:
docs/azure.md - Vercel AI SDK reference snapshot:
docs/ai-sdk.md - Contributing/dev setup:
docs/contributing.md
License
MIT. See LICENSE.

