Skip to main content

Providers

TF Code supports multiple AI providers alongside ToothFairyAI. Use tfcode providers list to see which are configured, and tfcode models to see available models.

Models are selected with the provider/model-id format, for example amazon-bedrock/anthropic.claude-opus-4-6-v1.

ToothFairyAI (Default)

ToothFairyAI is the default provider. Set it up via tfcode setup or environment variables:

tfcode setup

Or:

export TF_WORKSPACE_ID="your-workspace-id"
export TF_API_KEY="your-api-key"
export TF_REGION="au"

Credentials from your profile, environment, or config are resolved automatically.

Amazon Bedrock

Provider ID: amazon-bedrock

Amazon Bedrock uses the @ai-sdk/amazon-bedrock SDK. Before using a model, make sure you have requested access to it in the AWS Bedrock console.

Authentication

Choose one of these methods:

  1. Environment variables (quick start)

    AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=yyy AWS_REGION=ap-southeast-2 tfcode
    # or
    AWS_PROFILE=my-profile AWS_REGION=ap-southeast-2 tfcode
    # or
    AWS_BEARER_TOKEN_BEDROCK=xxx tfcode
  2. Config file (recommended for persistent setup)

    {
    "provider": {
    "amazon-bedrock": {
    "options": {
    "region": "ap-southeast-2",
    "profile": "my-aws-profile"
    }
    }
    }
    }

Authentication precedence:

  1. AWS_BEARER_TOKEN_BEDROCK (env or /connect)
  2. AWS credential chain (profile, access keys, IAM roles, etc.)

Configuration file options take precedence over environment variables for region and profile. Region resolution order is: config region > env AWS_REGION > default us-east-1.

Selecting models

Use /models in the TUI or set the default:

{
"model": "amazon-bedrock/anthropic.claude-opus-4-6-v1"
}

For cross-region inference, TF Code automatically adds the correct prefix for your region (for example au. for ap-southeast-2). You do not need to include the prefix in your config.

Custom inference profiles

If you have a custom inference profile, add it under provider.amazon-bedrock.models and set the id to the ARN:

{
"provider": {
"amazon-bedrock": {
"options": {
"region": "ap-southeast-2",
"profile": "my-aws-profile"
},
"models": {
"my-claude-opus": {
"id": "arn:aws:bedrock:ap-southeast-2:123456789012:application-inference-profile/abc123"
}
}
}
}
}

Then reference it as amazon-bedrock/my-claude-opus.

VPC endpoints

Use the endpoint option (alias for baseURL) to route through a VPC endpoint:

{
"provider": {
"amazon-bedrock": {
"options": {
"region": "ap-southeast-2",
"profile": "production",
"endpoint": "https://bedrock-runtime.ap-southeast-2.vpce-xxxxx.amazonaws.com"
}
}
}
}

Anthropic

Provider ID: anthropic

Authenticate with an Anthropic API key:

export ANTHROPIC_API_KEY="your-api-key"

Or set it in tfcode.json:

{
"provider": {
"anthropic": {
"options": {
"apiKey": "your-api-key"
}
}
}
}

Select a model via /models or set the default:

{
"model": "anthropic/claude-opus-4-8"
}

OpenAI

Provider ID: openai

Authenticate with an OpenAI API key:

export OPENAI_API_KEY="your-api-key"

Or set it in tfcode.json:

{
"provider": {
"openai": {
"options": {
"apiKey": "your-api-key"
}
}
}
}

Select a model via /models or set the default:

{
"model": "openai/gpt-5"
}

Google Gemini

There are two Google providers:

  • google — Gemini API (api key based)
  • google-vertex — Google Cloud Vertex AI (GCP project based)

Gemini API (google)

Set the API key:

export GOOGLE_API_KEY="your-api-key"
# or
export GOOGLE_GENERATIVE_AI_API_KEY="your-api-key"

Or in tfcode.json:

{
"provider": {
"google": {
"options": {
"apiKey": "your-api-key"
}
}
}
}

Select a model:

{
"model": "google/gemini-2.5-pro"
}

Vertex AI (google-vertex)

Set the GCP project and location:

export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
export GOOGLE_VERTEX_LOCATION="us-central1"

Or in tfcode.json:

{
"provider": {
"google-vertex": {
"options": {
"project": "your-project-id",
"location": "us-central1"
}
}
}
}

location defaults to us-central1. Use global for better availability when data residency is not a constraint.

Select a model:

{
"model": "google-vertex/gemini-2.5-pro"
}

Select a Model

Use --model <provider>/<model-id> on the CLI:

tfcode run "Review this PR" --model amazon-bedrock/anthropic.claude-opus-4-6-v1
tfcode run "Explain this code" --model toothfairyai/mystica

In the TUI, use /models to browse and select.

Set a default in your config:

{
"model": "toothfairyai/mystica"
}

Discover Models

tfcode models # All available models
tfcode models toothfairyai # Models for a specific provider
tfcode models --verbose # Include metadata like costs
tfcode models --refresh # Refresh the cache
tfcode providers list # List configured providers

Provider Options

All providers support common options under provider.<id>.options:

  • timeout — request timeout in milliseconds (default 300000)
  • chunkTimeout — timeout between streamed SSE chunks in milliseconds
  • baseURL — custom endpoint URL
  • apiKey — API key for providers that use one
{
"provider": {
"anthropic": {
"options": {
"timeout": 600000,
"chunkTimeout": 30000
}
}
}
}

Model Loading Order

  1. --model / -m CLI flag
  2. model in config file
  3. Last used model
  4. Internal priority