CreativeMath LLM Providers: Complete Guide to Supported Models and APIs

CreativeMath supports six LLM provider categories including Anthropic, OpenAI, Google Gemini, DeepSeek, and six local Hugging Face models, with provider selection handled automatically by the ModelLoader class based on config.json mappings.

CreativeMath is an open-source mathematical reasoning framework that integrates with multiple large language model providers to generate and evaluate novel solutions. Understanding which LLM providers are supported by CreativeMath is essential for researchers configuring experiments across hosted APIs and local deployments. The framework abstracts provider-specific implementation details through a unified ModelLoader interface defined in src/models/model_loader.py.

Supported LLM Providers Overview

CreativeMath categorizes supported models into hosted API services and local Hugging Face deployments. The complete list of supported model identifiers is defined in config.json under the model_version key (lines 9-22). The framework currently supports four major API providers and six distinct local model architectures.

Provider Supported Models Implementation File
Anthropic claude-3-opus, claude-3-5-sonnet src/models/api_models.py (lines 21-24)
OpenAI gpt-4, gpt-4o, gpt-4o-mini src/models/api_models.py (lines 35-38)
Google Gemini gemini-1.5-pro src/models/api_models.py (lines 32-35)
DeepSeek deepseek-v2 src/models/api_models.py (lines 23-31)
Local HF Models Deepseek-math-7b-rl, Internlm2-math-20b, Llama-3-70B, Mixtral-8x22B, Qwen1.5-72B, Yi-1.5-34B src/models/local_models.py (lines 15-48)

Hosted API Providers

The src/models/api_models.py file contains the client initialization logic for all hosted services, automatically selecting the appropriate SDK based on the model name passed to the constructor.

Anthropic Claude

CreativeMath supports Anthropic's Claude models through the official Anthropic Python SDK. When the model name matches claude-3-opus or claude-3-5-sonnet, the framework initializes an Anthropic client in src/models/api_models.py (lines 21-24). These models are accessed via Anthropic's API endpoint using the API key configured in config.json.

OpenAI GPT Models

The framework supports OpenAI's GPT-4 family including gpt-4, gpt-4o, and gpt-4o-mini. In src/models/api_models.py (lines 35-38), CreativeMath instantiates an OpenAI client for any of these model identifiers. The implementation handles standard chat completions through OpenAI's REST API.

Google Gemini

Google's Gemini models are supported through the google.generativeai SDK. When gemini-1.5-pro is specified, src/models/api_models.py (lines 32-35) configures the Google API and builds a GenerativeModel client. This provider requires a Google API key configured in the framework's configuration file.

DeepSeek API

CreativeMath supports DeepSeek's hosted API using a specialized OpenAI-compatible client. For the deepseek-v2 model, src/models/api_models.py (lines 23-31) constructs an OpenAI client pointed at DeepSeek's API endpoint rather than OpenAI's. This allows the framework to leverage DeepSeek's reasoning capabilities while using the same underlying client infrastructure.

Local Hugging Face Models

For researchers requiring offline inference or custom fine-tuned weights, CreativeMath supports six local models loaded via the Hugging Face transformers library. The loading logic resides in src/models/local_models.py (lines 15-48), which uses AutoTokenizer and AutoModelForCausalLM to initialize models.

The supported local models are:

  • Deepseek-math-7b-rl
  • Internlm2-math-20b
  • Llama-3-70B
  • Mixtral-8x22B
  • Qwen1.5-72B
  • Yi-1.5-34B

Each model has custom generation paths optimized for mathematical reasoning tasks, with prompts formatted using each model's specific chat template.

Provider Selection Architecture

CreativeMath abstracts provider complexity through a unified loading mechanism centered on src/models/model_loader.py. The ModelLoader class checks the model_version mapping in config.json to determine whether to instantiate an API client via load_api_model or a local pipeline via load_local_model.

For API models, generate_api_response in src/models/api_models.py formats requests provider-specifically while exposing a uniform interface. For local models, generate_local_response in src/models/local_models.py handles tokenization and inference.

Usage Examples

Command-Line Generation

Researchers can invoke any supported provider directly from the command line using src/generation.py:


# Generate with OpenAI GPT-4o

python src/generation.py --model_name gpt-4o

# Generate with Anthropic Claude-3-opus

python src/generation.py --model_name claude-3-opus

# Generate with local Llama-3-70B

python src/generation.py --model_name Llama-3-70B

Programmatic Inference

For custom pipelines, instantiate the ModelLoader directly:

from src.models.model_loader import ModelLoader

# Select any supported provider

model_name = "gemini-1.5-pro"      # Google Gemini

# model_name = "deepseek-v2"       # DeepSeek API

# model_name = "Mixtral-8x22B"    # Local HF model

loader = ModelLoader(model_name)
client = loader.model

messages = [
    {"role": "system", "content": "You are a math researcher."},
    {"role": "user", "content": "Propose a novel solution approach..."}
]

if loader.is_api:
    response = loader.generate_api_response(messages)
else:
    model, tokenizer = client
    response = loader.generate_local_response(model, tokenizer, messages)

print(response)

Summary

  • CreativeMath supports six categories of LLM providers: Anthropic, OpenAI, Google Gemini, DeepSeek, and local Hugging Face models.
  • Hosted API clients are implemented in src/models/api_models.py, while local model loading resides in src/models/local_models.py.
  • The ModelLoader class in src/models/model_loader.py automatically routes requests to the appropriate provider based on config.json mappings.
  • Supported models range from Claude-3-opus and GPT-4o to specialized mathematical models like Deepseek-math-7b-rl and Internlm2-math-20b.

Frequently Asked Questions

How do I add a new LLM provider to CreativeMath?

To add a new provider, extend src/models/api_models.py to implement the client initialization and response generation logic, then add the model identifier to config.json under the model_version key. The ModelLoader class will automatically detect the new mapping and route requests accordingly, provided you follow the existing pattern of checking model name prefixes.

Can I switch between API and local models without changing code?

Yes. The ModelLoader class automatically determines whether to use API or local inference based on the model name provided in --model_name (CLI) or the constructor argument (Python). As long as the model is defined in config.json, the framework handles provider selection transparently without requiring changes to your generation or evaluation scripts.

What authentication is required for hosted LLM providers?

Each hosted provider requires its respective API key configured in config.json. Anthropic requires an Anthropic API key, OpenAI and DeepSeek require their specific keys, and Google Gemini requires a Google API key. Local Hugging Face models do not require API keys but may require authentication tokens for downloading gated models from the Hugging Face Hub.

Are there performance differences between API and local models?

API providers offer high-performance inference without local GPU requirements, making them suitable for rapid experimentation and teams without dedicated hardware. Local models in src/models/local_models.py require significant GPU memory—particularly 70B parameter models like Llama-3-70B—but offer advantages in data privacy, cost control for high-volume inference, and customization through fine-tuning or specialized quantization.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →