← Blog
GooseIntegrationCoding agents

Goose with Claude and GPT: Custom API Setup (CLI & Desktop)

(prices in the text follow the live price list)

Short answer

To use Goose with APIVAI, run goose configure, choose Configure Providers and then OpenAI, paste your APIVAI key as OPENAI_API_KEY, answer Yes to the advanced settings question and set OPENAI_HOST to https://api.apivai.com without /v1, then pick a model such as claude-sonnet-4-6 or gpt-5.5. Goose adds the path itself: OPENAI_BASE_PATH defaults to v1/chat/completions, so the host must stay the bare domain. For Claude only, you can choose the Anthropic provider instead and set ANTHROPIC_HOST to the same https://api.apivai.com, because Goose appends v1/messages. As of 2026-10-10, Claude Sonnet 4.6 costs $1.15 / $5.74 per million input / output tokens through APIVAI, against the official $3.00 / $15.00, paid per token from a prepaid balance with no subscription.

What is Goose, and why use your own API key?

Goose is an open-source AI agent, originally created by Block, that runs on your own machine as a command-line tool (goose CLI) and a desktop app (goose Desktop). It edits files, runs commands and connects to other tools through extensions (MCP servers). Goose ships without a model: you connect an LLM provider, and every step of a session is a request billed by that provider.

This guide was checked against the Goose documentation and source code for version 1.54 (October 2026).

APIVAI gives you one key for Claude and GPT, billed per token below official list prices for most models, from a balance you top up yourself. The same key works in the OpenAI format and in the Anthropic format, so it fits both of Goose's built-in providers that matter here.

Which Goose provider should you use with APIVAI?

Goose providerSettingValueModels
OpenAI (built-in)OPENAI_HOSThttps://api.apivai.comClaude and GPT
Anthropic (built-in)ANTHROPIC_HOSThttps://api.apivai.comClaude only
Custom provider, OpenAI CompatibleAPI URLhttps://api.apivai.com/v1Claude and GPT
Custom provider, Anthropic CompatibleAPI URLhttps://api.apivai.comClaude only

The two host settings take only the server root. Goose joins the host with a request path: v1/chat/completions (from OPENAI_BASE_PATH), v1/responses or v1/messages. A host ending in /v1 therefore produces /v1/v1/... and a 404.

Pick OpenAI for one setup that covers every model. With this provider, Goose sends GPT-5 and GPT-6 family models to the Responses API (v1/responses) and other models, such as Claude, to v1/chat/completions; APIVAI serves both endpoints. Pick Anthropic if you only use Claude: Goose turns on prompt caching automatically for Claude models on the Anthropic provider, so repeated context is billed at the cache-read price of $0.12 per million tokens for Claude Sonnet 4.6 instead of the full input price. Cache writes cost $1.44 per million.

How do you set up Goose with APIVAI step by step?

Step 1: Create an APIVAI key

  1. Sign up at apivai.com with your email.
  2. Top up from $10 by card, crypto, Alipay or WeChat Pay. There is no free trial or subscription.
  3. In the Dashboard, create a key and copy it. Give it a budget limit if you want a hard cap on what Goose can spend.

Step 2: Configure the OpenAI provider in goose CLI

  1. Run goose configure.
  2. Select Configure Providers and press Enter.
  3. Choose OpenAI.
  4. When asked for OPENAI_API_KEY, paste your APIVAI key.
  5. At Would you like to configure advanced settings? answer Yes, then fill in the prompts as in the table below. Press Enter to skip the others (organization, project, custom headers, timeout).
  6. Pick the model from the list, search for it, or choose Enter a model not listed... and type the exact ID.
  7. Start working with goose session.
PromptValue
OPENAI_API_KEYYour APIVAI key
OPENAI_BASE_URLLeave empty (press Enter)
OPENAI_HOSThttps://api.apivai.com
OPENAI_BASE_PATHLeave empty: the default is v1/chat/completions
Modelclaude-sonnet-4-6 (or any ID from GET /v1/models)

In older Goose releases the host prompt appears right after the key, without the advanced settings question; the values are the same. Goose stores the key in your system keyring (or in secrets.yaml if no keyring is available), never in config.yaml.

Check which IDs your key can use:

curl https://api.apivai.com/v1/models \
  -H "Authorization: Bearer YOUR_APIVAI_KEY"

Models are added and retired over time, so copy IDs from this list or from the pricing page.

Step 3 (optional): Use the Anthropic provider for Claude

Run goose configure again, choose Configure Providers and then Anthropic. Paste the same key as ANTHROPIC_API_KEY, answer Yes to the advanced settings, set ANTHROPIC_HOST to https://api.apivai.com and pick a Claude model. Do not add /v1: Goose sends Anthropic requests to the host plus v1/messages, which gives https://api.apivai.com/v1/messages. More on the Anthropic format is on the Claude API proxy page.

Step 4: Or set it up in goose Desktop

  1. Open the sidebar, click Settings, open the Models tab and click Configure providers.
  2. Click OpenAI, enter your APIVAI key and set the host (OPENAI_HOST) to https://api.apivai.com. Click Submit.
  3. In Models, click Switch models, choose the OpenAI provider, select Use custom model, type claude-sonnet-4-6 and click Select model.

You can also click Add Custom Provider at the bottom of the provider list: set Provider Type to OpenAI Compatible, Display Name to APIVAI, API URL to https://api.apivai.com/v1, paste the key, list model IDs in Available Models (comma-separated) and click Create Provider. A custom provider keeps APIVAI separate from a real OpenAI setup.

Step 5: Environment variables for scripts and CI

export OPENAI_API_KEY="YOUR_APIVAI_KEY"
export OPENAI_HOST="https://api.apivai.com"
export GOOSE_PROVIDER="openai"
export GOOSE_MODEL="claude-sonnet-4-6"
export GOOSE_MAX_TOKENS=8192
goose session

On Windows PowerShell, use $env:OPENAI_HOST = "https://api.apivai.com" and so on. Environment variables override the config file for that process. Don't put the API key in config.yaml: Goose ignores provider keys there.

Which model should you choose in Goose?

Prices per 1M input / output tokens as of 2026-10-10:

Model IDPrice (in / out)Good for
claude-sonnet-4-6$1.15 / $5.74Everyday agent work: the default
claude-sonnet-5-5$0.77 / $3.82Newer Sonnet for coding
claude-opus-5-5$1.54 / $7.65Hardest tasks, long plans
claude-haiku-4-5$0.38 / $1.92Fast, cheap sessions and recipes
gpt-5.5$0.77 / $4.56GPT alternative
gpt-6-luna$0.0144 / $0.0768Very cheap runs

Goose relies on tool calling for everything it does, so use models that support it; all models above do. GPT models need the OpenAI provider or an OpenAI Compatible custom provider.

How much does Goose cost with APIVAI?

Each turn of a Goose session resends the conversation, tool results and extension instructions, so input tokens dominate. Two worked examples:

  • One working session on Claude Sonnet 4.6: about 30 requests of 30,000 input and 1,500 output tokens each. Cost: $1.29 with APIVAI, $3.38 at official prices.
  • A month of two such sessions a day for 22 days (1,320 requests): $56.91 with APIVAI, $149 at official prices. Running a small daily recipe on Claude Haiku 4.5 instead (10 requests of 10,000 input and 1,000 output tokens, 220 a month) costs $1.26.

These figures ignore prompt caching on the Anthropic provider. Thinking tokens count as output tokens. Your real numbers per request are on the Dashboard. For a wider comparison, read Claude API pricing in 2026.

How do you fix common Goose errors?

  • 401 Unauthorized: the key is wrong, deleted or over its budget limit, or it was put in config.yaml, where Goose ignores it. Run goose configure again or set OPENAI_API_KEY / ANTHROPIC_API_KEY.
  • 404 Not Found: wrong /v1. OPENAI_HOST and ANTHROPIC_HOST are https://api.apivai.com with no path, and OPENAI_BASE_PATH stays v1/chat/completions. Don't set OPENAI_BASE_URL and OPENAI_HOST to conflicting values.
  • Model not found: use the exact ID, such as claude-sonnet-4-6, not a display name. Compare with GET /v1/models.
  • Empty or truncated replies: thinking is on by default and uses output tokens. Set GOOSE_MAX_TOKENS to 8192 (at least 4096).
  • 429 Too Many Requests: the default limit is 60 requests per minute per key. Wait briefly, or ask support to raise it.

More on request formats is in the docs and on the OpenAI-compatible API page.

FAQ

Can I use Claude and GPT in Goose with one key?

Yes. One APIVAI key works for every model. With the OpenAI provider you only change GOOSE_MODEL or switch models in the app.

Why no /v1 in OPENAI_HOST?

Goose builds the URL from the host plus OPENAI_BASE_PATH, which already starts with v1/. The full request goes to https://api.apivai.com/v1/chat/completions.

Should I use the OpenAI or the Anthropic provider?

Use OpenAI for GPT models or one setup for everything. Use Anthropic for Claude-only work, where Goose enables prompt caching; its host is also https://api.apivai.com.

Does APIVAI provide embeddings for Goose?

No. APIVAI serves chat models only; chat, tool calls and extensions work, but anything that needs an embedding model must use a separate provider.

Does APIVAI store my data?

No. Request and response content is not logged; only usage data such as model, tokens and cost is kept for billing.

Is there a similar terminal agent guide?

Yes. See the Aider guide and the OpenCode guide.

Create an account, top up from $10 and paste your key into Goose.

Ready to start?

Get your API key in 30 seconds. Pay as you go for Claude and GPT.

Get Started