Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Claude API Provider

The claude-api provider talks to the Claude Messages API directly with an x-api-key header. Use this when you have a Claude API key (billed per-token). For Claude Code OAuth, see claude-oauth.

Configuration

SettingValue
Profile typeclaude-api
Default base URLhttps://api.anthropic.com
CredentialAPI key (sk-ant-api03-...) stored in the database
Auth methodx-api-key header
API version2023-06-01

Quickest Start

meka provider add anthropic --type claude-api --model claude-opus-4-6

meka provider add prompts for your Claude API key, stores it in the database, and writes the [providers.anthropic] profile. To read the key from a pipe instead of prompting, pass --api-key-stdin.

Config File

meka provider add writes this for you (the key stays in the database, not here):

default_provider = "anthropic"

[providers.anthropic]
type = "claude-api"
model = "claude-opus-4-6"

Supported Models

Any model available through the Claude Messages API. Current line-up (per Anthropic’s models overview):

FamilyAliasNotes
Opus 4.7claude-opus-4-7Latest Opus; most capable, adaptive thinking
Sonnet 4.6claude-sonnet-4-6Latest Sonnet, speed + intelligence balance
Haiku 4.5claude-haiku-4-5Latest Haiku, fastest

Older but still available: claude-opus-4-6, claude-sonnet-4-5, claude-opus-4-5, claude-opus-4-1. Deprecated and retiring 2026-06-15: claude-opus-4-20250514, claude-sonnet-4-20250514.

Custom Base URL

To use a Claude-API-compatible proxy or gateway:

meka --provider claude-api --model claude-opus-4-6 --base-url https://my-proxy.example.com

API Details

Endpoint: POST {base_url}/v1/messages

Headers:

  • x-api-key: <api_key>
  • anthropic-version: 2023-06-01
  • content-type: application/json

System prompt: Sent as a top-level system string.

Tool format: Tools are defined with input_schema:

{
  "name": "read_file",
  "description": "Read the contents of a file at the given path.",
  "input_schema": { "type": "object", "properties": { ... } }
}

Streaming: Server-Sent Events with named event types (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop, ping).