Skip to main content
Connect Glyph to Anthropic’s API to use Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku, and other models.

Prerequisites

  • Anthropic API account: console.anthropic.com
  • API key with appropriate permissions
  • Sufficient API credits

Setup

1

Get API Key

  1. Log in to Anthropic Console
  2. Navigate to API Keys
  3. Click Create Key
  4. Copy the key (starts with sk-ant-)
Store your API key securely. Anthropic only shows it once.
2

Open Glyph AI Settings

Go to Settings → AI and select the Anthropic profile.
3

Add API Key

  1. Click Set API Key in the authentication section
  2. Paste your Anthropic API key
  3. Click Save
The key is stored in .glyph/app/ai_secrets.json in your space directory.
4

Select Model

Click the Model dropdown. Glyph fetches available models from Anthropic’s API.Popular models:
  • claude-3-5-sonnet-20241022 - Latest Claude 3.5 Sonnet (recommended)
  • claude-3-opus-20240229 - Most capable, best for complex tasks
  • claude-3-sonnet-20240229 - Balanced performance and speed
  • claude-3-haiku-20240307 - Fastest, most affordable
5

Test Connection

Open the AI panel and send a test message. You should receive a response from Claude.

Configuration

Provider Settings

  • Service: anthropic
  • Base URL: https://api.anthropic.com (default)
  • Authentication: x-api-key header
  • API Version: 2023-06-01 (automatically set)

Custom Endpoint

To use a custom Anthropic endpoint (proxy, self-hosted):
  1. Set Base URL to your endpoint (e.g., https://your-proxy.com)
  2. Add any required headers in Custom Headers
  3. Enable Allow Private Hosts if using localhost

Model Selection

Glyph fetches the latest model list from Anthropic’s /v1/models endpoint.
ModelUse CaseContext WindowMax Output
claude-3-5-sonnet-20241022General purpose, coding200K tokens8K tokens
claude-3-opus-20240229Complex reasoning, analysis200K tokens4K tokens
claude-3-sonnet-20240229Balanced tasks200K tokens4K tokens
claude-3-haiku-20240307Fast, simple tasks200K tokens4K tokens
Claude models have a 200K token context window, allowing you to attach large amounts of context from your notes.

Max Tokens Requirement

Anthropic requires the max_tokens parameter for all requests. Glyph automatically sets this to 2048 tokens for Anthropic models. If you need longer responses, this value is hardcoded in src-tauri/src/ai_rig/runtime.rs:73.

Features

Chat Mode

Conversational interaction without tools:
  • Back-and-forth dialogue with Claude
  • No file system access
  • Faster responses
  • Best for discussion and brainstorming

Create Mode

Claude with workspace tools:
  • read_file - Read files from your space
  • search_notes - Search note content
  • list_dir - List directory contents
  • Tool usage shown in timeline view
  • Best for research, summarization, and analysis

Context Attachment

Attach notes to leverage Claude’s 200K context window:
  • Attach files or folders via context menu
  • Mention with @filename syntax
  • Configure character budget (up to 250K chars)
  • View token estimates before sending

API Usage and Billing

Glyph makes direct API calls to Anthropic:
  • You are billed by Anthropic based on token usage
  • No additional fees from Glyph
  • Check usage at console.anthropic.com

Cost Estimation

ModelInput (per 1M tokens)Output (per 1M tokens)
Claude 3.5 Sonnet$3.00$15.00
Claude 3 Opus$15.00$75.00
Claude 3 Sonnet$3.00$15.00
Claude 3 Haiku$0.25$1.25
Use the context manifest to estimate costs before sending.

Rate Limits

Anthropic enforces rate limits based on your usage tier:
  • Limits vary by model and tier
  • Check your tier at console.anthropic.com
  • Rate limit errors include retry-after headers
If you hit rate limits, Glyph displays the error. Wait before retrying.

Troubleshooting

”API key not set for this profile”

Solution: Add your Anthropic API key in Settings → AI.

”model list failed (401)”

Solution: Your API key is invalid or expired. Generate a new key from Anthropic Console.

”model list failed (403)”

Solution: Your API key doesn’t have permission to list models. This is non-fatal; type the model ID manually.

”model list failed (429)”

Solution: You’ve hit Anthropic’s rate limit. Wait before retrying.

Model list is empty

Solution: Type the model ID manually:
  • claude-3-5-sonnet-20241022
  • claude-3-opus-20240229
  • claude-3-haiku-20240307
The model will work even if the list fetch failed.

Responses are truncated

Cause: Anthropic’s max_tokens parameter (default 2048) limits output length. Solution: To increase output length, modify src-tauri/src/ai_rig/runtime.rs:73 and rebuild:
let max_tokens = if caps.requires_max_tokens {
    Some(4096)  // Increase from 2048
} else {
    None
};

“context length exceeded”

Cause: Total tokens (context + conversation) exceeds 200K. Solution: Reduce attached context or use a smaller character budget.

Security Best Practices

  • Never commit .glyph/app/ai_secrets.json to version control
  • Rotate API keys if exposed
  • Use separate keys for different projects
  • Monitor usage in Anthropic Console

Claude-Specific Tips

Extended Thinking

Claude models excel at reasoning tasks. In create mode, Claude can:
  • Read multiple files to synthesize information
  • Search your notes for relevant context
  • Chain multiple tool calls to answer complex questions

System Prompts

Claude respects system prompts well. In create mode, Glyph adds:
Tool discipline for this run: use the minimum number of tool calls needed.
Prefer at most 1-2 search/list calls before answering.
If a tool returns usable evidence, stop searching and summarize.
This reduces unnecessary tool usage and improves response speed.

Markdown and Code

Claude generates well-formatted markdown and code. Responses render beautifully in Glyph’s AI panel.

Next Steps

Chat Modes

Learn about chat vs create modes

Context Management

Attach notes to leverage Claude’s 200K context

OpenAI

Compare with OpenAI GPT models

Profiles

Manage multiple AI profiles