camelAI Documentation

Guides

Use custom model servers, vLLM, Ollama, or gateways in camelRun v2

Configure custom OpenAI-compatible, Anthropic, or Gemini model servers in camelRun v2 using PUT /v2/providers/:provider with baseUrl, apiStyle, headers, and modelAliases.

View as Markdown

You can point camelRun v2 at any HTTPS model server (such as vLLM, Ollama behind a tunnel, LiteLLM, Azure OpenAI deployments, or an internal gateway) by configuring a provider with baseUrl, apiStyle, optional custom headers, and modelAliases.

Register a custom provider

Use PUT /v2/providers/:provider (or a scoped provider at PUT /v2/key-scopes/:scope/providers/:provider) with a custom provider name such as custom or your own lowercase slug:

bash
curl -s -X PUT "https://run.camelai.com/v2/providers/custom" \
  -H "Authorization: Bearer $CAMELRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "your-gateway-token",
    "baseUrl": "https://llm.example.com/v1",
    "apiStyle": "openai-chat",
    "headers": {
      "X-Gateway-Tenant": "acme"
    },
    "modelAliases": {
      "llama-70b": "meta-llama/Llama-3.3-70B-Instruct"
    }
  }'

Supported apiStyle values

apiStyleProtocolDefault base URL if baseUrl is omitted
openai-chatOpenAI Chat Completions (/chat/completions)https://api.openai.com/v1
openai-responsesOpenAI Responses API (/responses)https://api.openai.com/v1
anthropicAnthropic Messages API (/v1/messages)https://api.anthropic.com
geminiGoogle Gemini Generative Language APIhttps://generativelanguage.googleapis.com

Either apiKey or a non-empty headers map is required. If your gateway authenticates exclusively through custom headers (for example X-API-Key or CF-Access-Client-Id / CF-Access-Client-Secret), you can omit apiKey and supply headers alone.

Use your custom model in an agent

Reference the model as <provider>/<modelOrAlias>:

ts
const agent = await client.agents.upsert("local-llm-agent", {
  model: "custom/llama-70b",
  instructions: "Answer briefly and cite tool results.",
});

const run = await agent.run("Explain content-addressed storage in two sentences.");
console.log(run.text);

Any entries you declare in modelAliases automatically appear in GET /v2/models as <provider>/<alias> with available: true.

Azure OpenAI deployments

To bring your own Azure OpenAI resource, configure the azure provider with your resource endpoint and deployment aliases:

bash
curl -s -X PUT "https://run.camelai.com/v2/providers/azure" \
  -H "Authorization: Bearer $CAMELRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "your-azure-api-key",
    "baseUrl": "https://my-resource.openai.azure.com/openai/v1",
    "apiStyle": "openai-responses",
    "modelAliases": {
      "prod-gpt": "my-gpt-deployment"
    }
  }'

Then set model: "azure/prod-gpt" on your agents or definitions.