Skip to main content
Declarative providers allow you to add support for new LLM providers without writing Rust code. Simply define the provider’s configuration in a JSON file.

What are Declarative Providers?

Declarative providers are JSON configuration files that define:
  • Provider metadata (name, description)
  • API endpoint configuration
  • Supported models and their capabilities
  • Authentication requirements
  • Protocol format (OpenAI-compatible, etc.)
Goose automatically loads these configurations and creates fully functional providers.

Configuration File Structure

Declarative providers are located in crates/goose/src/providers/declarative/.

Basic Structure

Field Reference

Required Fields

name (string)
  • Unique identifier for the provider
  • Used in configuration and CLI
  • Must be lowercase, alphanumeric with underscores
engine (string)
  • Protocol/format the provider uses
  • Currently supported: "openai"
  • Determines how requests are formatted
display_name (string)
  • Human-readable name shown in UIs
  • Can include spaces and special characters
description (string)
  • Brief description of the provider
  • Shown in provider selection UIs
api_key_env (string)
  • Environment variable name for API key
  • Convention: PROVIDER_API_KEY format
base_url (string)
  • API endpoint URL
  • For OpenAI-compatible providers, include full path to chat completions
models (array) supports_streaming (boolean)
  • Whether the provider supports streaming responses
  • Most modern providers support this

Model Configuration

Each model in the models array defines:

Model Fields

name (string, required)
  • Model identifier used in API requests
  • Exact string the provider expects
context_limit (integer, required)
  • Maximum context window size in tokens
  • Used for context management
max_tokens (integer, required)
  • Maximum output tokens per request
  • Used to limit response length
input_token_cost (float, optional)
  • Cost per input token in USD
  • Used for cost estimation
output_token_cost (float, optional)
  • Cost per output token in USD
  • Used for cost estimation

Complete Examples

Groq Provider

Mistral Provider

DeepSeek Provider

Local Model Provider

Creating a New Declarative Provider

1. Create Configuration File

Create a new JSON file in crates/goose/src/providers/declarative/:

2. Define Configuration

3. Rebuild Goose

The provider is automatically loaded at build time:

4. Configure and Use

Set the API key:
Configure Goose:
Start using:

OpenAI-Compatible APIs

Many providers offer OpenAI-compatible APIs. For these:
  1. Set "engine": "openai"
  2. Use the provider’s base URL
  3. Ensure model names match what the provider expects
Examples:
  • Together AI
  • Fireworks AI
  • Anyscale Endpoints
  • Modal
  • Replicate (with OpenAI compatibility)

Advanced Configuration

Multiple Model Variants

Include all model variants with accurate limits:

Special Model Naming

Some providers use prefixes or special characters:

Cost Tracking

Include accurate pricing for cost estimation:
Costs are per token in USD. Goose will:
  • Track token usage
  • Estimate costs per request
  • Show cumulative costs

Validation

Testing Your Provider

After creating a declarative provider:

Common Issues

Provider not found
  • Ensure JSON file is in crates/goose/src/providers/declarative/
  • Rebuild: cargo build
  • Check provider name matches filename (without .json)
Authentication failed
  • Verify environment variable name matches api_key_env
  • Check API key is set: echo $MYPROVIDER_API_KEY
  • Ensure API key format is correct
Model not found
  • Verify model name exactly matches provider’s API
  • Check provider documentation for exact model identifiers
Context limit errors
  • Reduce context_limit if requests fail
  • Check provider’s actual model limits
  • Some providers report limits differently

Limitations

Declarative providers currently:
  • Only support OpenAI-compatible APIs
  • Cannot implement custom OAuth flows
  • Cannot handle complex authentication schemes
  • Cannot customize request/response transformation
For providers requiring these features, implement a custom provider.

Contributing Declarative Providers

To add a provider to Goose:
  1. Create the JSON configuration file
  2. Test thoroughly
  3. Document model capabilities accurately
  4. Submit a PR to the Goose repository
  5. Include example usage in PR description
See Contributing Guide for details.

Existing Declarative Providers

Goose includes these declarative providers:
  • Groq - Fast inference
  • Mistral - Mistral AI models
  • DeepSeek - DeepSeek models
  • Cerebras - Cerebras inference
  • Moonshot - Moonshot AI
  • Kimi - Kimi models
  • LM Studio - Local model hosting
  • OVHcloud - OVHcloud AI endpoints
See crates/goose/src/providers/declarative/ for complete configurations.

Next Steps