← All docs

DOCS

  1. Getting Started
  2. Configuration
  3. Tools
  4. Sessions
  5. Compaction & Branch Summarization
  6. Subagents
  7. Extensions
  8. Themes
  9. Memory System
  10. Skills
  11. Code intelligence (LSP)
  12. Termux Support
  13. Environment variables
  14. Custom Providers
  15. JSON Event Stream Mode
  16. Keybindings
  17. Prompt Templates
  18. RPC Mode
  19. Session File Format
  20. Shell Aliases
  21. Terminal Setup
  22. tmux Setup
DOCS
  1. Getting Started
  2. Configuration
  3. Tools
  4. Sessions
  5. Compaction & Branch Summarization
  6. Subagents
  7. Extensions
  8. Themes
  9. Memory System
  10. Skills
  11. Code intelligence (LSP)
  12. Termux Support
  13. Environment variables
  14. Custom Providers
  15. JSON Event Stream Mode
  16. Keybindings
  17. Prompt Templates
  18. RPC Mode
  19. Session File Format
  20. Shell Aliases
  21. Terminal Setup
  22. tmux Setup
ON THIS PAGE
  1. Via Extensions
  2. ProviderConfig Options
  3. Model Definition
  4. OAuth Provider
  5. Behavior
  6. Via models.json
  7. apiKey Field
  8. Model Overrides
  9. Validation Rules

Custom Providers

Extensions can register custom model providers via neo.registerProvider(), and users can add providers via ~/.neo-code/agent/models.json.

#Via Extensions

import type { ExtensionAPI } from "@neosantara/code";

export default function (neo: ExtensionAPI) {
  neo.registerProvider("my-proxy", {
    name: "My Proxy",
    baseUrl: "https://proxy.example.com/v1",
    apiKey: "MY_PROXY_API_KEY",
    api: "openai-completions",
    models: [
      {
        id: "llama-3.1-70b",
        name: "Llama 3.1 70B",
        reasoning: false,
        input: ["text"],
        cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
        contextWindow: 128000,
        maxTokens: 4096,
      },
    ],
  });
}

#ProviderConfig Options

FieldTypeDescription
namestringDisplay name in UI
baseUrlstringAPI endpoint URL
apiKeystringEnv var name, literal value, or !command
apistring"openai-responses" or "openai-completions"
headersobjectCustom request headers
authHeaderbooleanAdd Authorization: Bearer automatically
modelsarrayModel definitions (replaces all existing for this provider)
streamSimplefunctionCustom streaming implementation
oauthobjectOAuth config for /login support

#Model Definition

FieldRequiredDescription
idyesModel identifier
nameyesDisplay name
reasoningyesSupports thinking/reasoning
inputyes["text"] or ["text", "image"]
costyes{ input, output, cacheRead, cacheWrite } per million tokens
contextWindowyesMax context tokens
maxTokensyesMax output tokens
apinoOverride provider API
baseUrlnoOverride provider URL
headersnoOverride provider headers
thinkingLevelMapnoCustom thinking level mapping
compatnoOpenAI compatibility settings

#OAuth Provider

neo.registerProvider("corporate-ai", {
  baseUrl: "https://ai.corp.com/v1",
  api: "openai-responses",
  models: [...],
  oauth: {
    name: "Corporate AI (SSO)",
    async login(callbacks) {
      callbacks.onAuth({ url: "https://sso.corp.com/..." });
      const code = await callbacks.onPrompt({ message: "Enter code:" });
      return { refresh: code, access: code, expires: Date.now() + 3600000 };
    },
    async refreshToken(credentials) {
      return credentials;
    },
    getApiKey(credentials) {
      return credentials.access;
    },
  },
});

#Behavior

  • During extension load: registrations are queued, applied after startup
  • After startup: takes effect immediately (no /reload needed)
  • If models provided: replaces ALL existing models for that provider
  • If only baseUrl provided: overrides URL for existing models
  • neo.unregisterProvider(name) removes provider and restores built-in models

#Via models.json

Add providers and models without writing an extension. File location: ~/.neo-code/agent/models.json

Supports // comments and trailing commas.

{
  "providers": {
    "ollama": {
      "name": "Ollama",
      "baseUrl": "http://localhost:11434/v1",
      "apiKey": "OLLAMA_API_KEY",
      "api": "openai-completions",
      "models": [
        {
          "id": "llama3.1:70b",
          "name": "Llama 3.1 70B",
          "reasoning": false,
          "input": ["text"],
          "contextWindow": 128000,
          "maxTokens": 4096
        }
      ]
    }
  }
}

#apiKey Field

The apiKey field supports three formats:

  • Env var name: "MY_API_KEY" — reads from environment
  • Literal value: "sk-abc123" — used directly
  • Command: "!my-command --get-key" — executes command, uses stdout

#Model Overrides

Override properties of built-in models without redefining them:

{
  "providers": {
    "neosantara": {
      "modelOverrides": {
        "deepseek-v4-0324": {
          "contextWindow": 200000,
          "maxTokens": 32000
        }
      }
    }
  }
}

#Validation Rules

  • Non-built-in providers with models require baseUrl and apiKey
  • Built-in providers can add models without baseUrl/apiKey (inherited)
  • Override-only configs need at least one of: baseUrl, headers, compat, modelOverrides
  • Each model needs api at provider or model level (unless built-in provider)

ON THIS PAGE

  1. Via Extensions
  2. ProviderConfig Options
  3. Model Definition
  4. OAuth Provider
  5. Behavior
  6. Via models.json
  7. apiKey Field
  8. Model Overrides
  9. Validation Rules
Previous← Environment variablesNextJSON Event Stream Mode →

Neo Code

Neosantara-first AI coding agent for your terminal.

Product

  • Docs
  • Pricing
  • GitHub

Neosantara

  • Dashboard
  • API

Legal

  • Terms
  • Privacy

2026 Neosantara. All rights reserved.