Can you use Claude Code with other models? What a gateway can and cannot do
Claude Code runs on Claude, but an API gateway lets it run other models and third-party APIs through MCP tools without handling raw secret keys.
On this page 7 sections
Claude Code's internal reasoning loop runs on Claude, but you can give it access to call hundreds of other models and third-party APIs through tools and an API gateway. By connecting an Model Context Protocol (MCP) server or providing gateway credentials, Claude Code can dispatch tasks to models from OpenAI, Google, DeepSeek, or Moonshot AI, create media assets, and run third-party API calls. You do not need to scatter API keys across your local environment or manage separate provider accounts to do it.
Understanding the difference between the model running the agent itself and the models the agent calls as tools helps you build cleaner workflows.
How Claude Code uses other models through an API gateway
Claude Code is an agentic coding tool built by Anthropic. Its decision loop, file inspection, and shell planning rely on Anthropic's Claude models. A gateway cannot change that core engine, but it changes what Claude Code can invoke while working on your project.
When you connect Claude Code to thelastapi's gateway via MCP or the CLI, the agent gains several capabilities:
- Calling alternative language models. Claude Code can run a prompt against GPT-6 Luna, DeepSeek V4.1 Flash, Gemini 3.8 Flash, or Kimi to compare outputs, generate synthetic test data, or verify translations.
- Generating media Claude cannot output natively. Claude Code cannot output raw video, voice audio, or images directly from its own model weights. An API gateway lets Claude Code generate images, short videos, spoken speech, and speech transcriptions directly into your project files. Learn more about this in Generate images and video from Claude Code.
- Interacting with third-party APIs through sealed connectors. Claude Code can execute operations against external APIs while the gateway keeps the provider secrets protected, preventing keys from leaking into chat context or shell logs.
- Scaffolding multi-model applications. Claude Code can configure an app to use an OpenAI-compatible gateway endpoint, letting your codebase use any lab's model through standard client libraries.
For details on wiring agent tooling, read What is MCP, and how do you give Claude Code real tools?.
What a gateway can and cannot change
It is equally important to understand the boundary: a gateway does not replace Claude Code's internal brain.
Claude Code sends its operational thinking, file reading, and task orchestration directly through Anthropic. You cannot point Claude Code's internal agent execution loop at DeepSeek or Gemini and expect the command-line CLI tool to operate identically.
Furthermore, a reliable gateway does not silently substitute models behind your back:
- No surprise fallbacks. If you ask for
vibiz/fastoranthropic/claude-opus-5.5and that provider is having an outage, the gateway returnsmodel_unavailableorprovider_unavailablewith a retry hint. It never quietly downgrades to another lab's model. - Exact model reporting. Every JSON response reports the exact model that executed the prompt (
served_model) and the precise cost in micro-dollars (cost_micro_usd). - Strict budget enforcement. The gateway halts calls with a
429error once project or account spend limits are hit. The account default is $5 per day, and a project daily budget defaults to $1.
Setting up the gateway with MCP
You can connect Claude Code to thelastapi using either a remote MCP server or a local process. Both methods provide tools like vibiz_ai_chat, vibiz_image_generate, vibiz_speech_create, and vibiz_speech_transcribe.
Option 1: Remote MCP (nothing to install)
Run this command in your terminal:
claude mcp add --transport http vibiz https://thelastapi.dev/mcpWhen Claude Code calls its first tool, your browser opens an Authorize page using OAuth 2.1 with PKCE. You choose between Full access or a Limited key. A Limited key can create projects, run deploys, send email, and call AI models, but it cannot view production secrets or move live money.
Option 2: Local MCP server
If you already use the vibiz CLI, you can attach the local MCP server directly:
claude mcp add vibiz -- npx -y @vibiz/cli mcpAlternatively, you can define a project-level .mcp.json file in your repository:
{
"mcpServers": {
"vibiz": {
"command": "npx",
"args": ["-y", "@vibiz/cli", "mcp"],
"env": { "VIBIZ_API_KEY": "${VIBIZ_API_KEY}" }
}
}
}The server reads VIBIZ_API_KEY from your shell or from a saved session created by running vibiz login. More instructions on agent setups can be found in the Agents documentation and the CLI documentation.
Models you can call from Claude Code
Once connected, Claude Code can invoke models through the vibiz_ai_chat MCP tool, or run them from the shell using the CLI:
vibiz ai "Summarize these customer notes" --model vibiz/fastYou can select a curated model alias or name a specific lab model by its catalog id:
| Model alias | Underlying lab model | Best suited for | Price per million tokens (in / out) |
|---|---|---|---|
vibiz/fast | GPT-6 Luna (OpenAI) | Fast chat, structured JSON, tool calls | $0.10 / $0.50 |
vibiz/lite | DeepSeek V4.1 Flash | High-volume context, lightweight tasks | $0.14 / $0.42 |
vibiz/balanced | Gemini 3.8 Flash (Google) | Balance of speed and reasoning | $0.825 / $4.125 |
vibiz/smart | Claude Sonnet 5.5 (Anthropic) | Complex coding and deep analysis | $2 / $10 |
vibiz/pro | Claude Opus 5.5 (Anthropic) | Highest reasoning capability tier | $4 / $20 |
You can also pass explicit IDs, such as anthropic/claude-opus-5.5 or moonshotai/kimi-k3.1-pro. Over 400 language models from OpenAI, Anthropic, Google, DeepSeek, xAI, Moonshot AI, Qwen, Mistral, and Meta are available. If Claude Code provides an invalid model identifier, the gateway returns a 400 invalid_request error naming param: "model", preventing accidental spend on unexpected models.
For account-level keys, rate limits default to 300 requests and 400,000 tokens per minute. Project keys receive 120 requests and 200,000 tokens per minute. Default max_tokens is 1,024 if unspecified, with a maximum allowable ceiling of 16,384.
Using third-party APIs with sealed keys
When your workflow requires third-party API providers outside standard AI labs, giving raw secret keys to an AI agent presents security risks. Claude Code can read files and shell histories.
thelastapi provides connectors to solve this. You import an OpenAPI 3 specification or manifest, and the gateway stores the credentials securely:
vibiz connectors import https://example.com/api/openapi.json --name external-crm --addOnce imported, Claude Code interacts through the vibiz_call tool or the CLI:
vibiz connectors call external-crm getCustomer id=usr_456If an API requires a secret, the agent uses vibiz_request_secret to generate a dedicated URL. The prompt never displays or stores the secret token locally. Learn more about protecting secrets in Call your own APIs through one gateway, with their keys sealed.
Building multi-model applications inside Claude Code
Beyond running queries during an interactive session, Claude Code can write code that accesses the entire model gateway. When your project initializes AI capabilities, the environment file receives VIBIZ_AI_BASE_URL and VIBIZ_AI_API_KEY:
vibiz init "Acme Agent" --resources ai
vibiz devClaude Code can then write standard Node.js or Python code using standard libraries without vendor-specific clients:
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: process.env.VIBIZ_AI_BASE_URL,
apiKey: process.env.VIBIZ_AI_API_KEY,
});
const response = await openai.chat.completions.create({
model: 'vibiz/balanced',
messages: [{ role: 'user', content: 'Generate sample test data for user accounts.' }],
});
console.log(response.choices[0]?.message.content);Using one gateway gives Claude Code and your application access to hosting, database, authentication, payments, and AI services from one place. Read more about streamlining agent infrastructure in One API key for an AI agent: hosting, database, email, payments and models.
To connect your coding agent and explore available models, review the Agents reference or run vibiz ai models in your terminal.
Frequently asked questions
Can I change Claude Code's internal model to GPT or DeepSeek?
No. Claude Code's internal agent loop, planning steps, and terminal execution run directly on Claude models provided by Anthropic.
How does Claude Code call other AI models if its core model cannot be changed?
Claude Code calls other models as external tools through MCP servers or the CLI, allowing it to send prompts to models like GPT-6 Luna or DeepSeek V4.1 Flash during its work.
What happens if a requested third-party model is unavailable?
The gateway returns a 400 or 500 level error, such as model_unavailable or provider_unavailable, with a retry hint rather than silently substituting a different model.
Can Claude Code spend unbounded amounts on third-party models?
No. Spend is capped by default daily account limits ($5 per day) and project limits ($1 per day), returning a 429 error whenever a budget ceiling is reached.