Skip to content

Models and BYOK

Pick a model. Pay with credits, your own keys or your own gateway.

Updated

Each agent sets its model in agent.yml with a provider/model id:

model:
  id: anthropic/claude-sonnet-5-5
  temperature: 0.2
  max_output_tokens: 8000
  reasoning: medium # none | low | medium | high
  allow_override: false

The providers are anthropic, openai, google, bedrock and azure. With allow_override: true, a run request can send "model": { "id": "…" }. Otherwise the request answers 422 model_override_denied. A public agent always refuses it.

Reasoning

model.reasoning sets how much the model reasons before it answers: none, low, medium or high. Without the key, the provider default applies. Reasoning tokens count as output tokens, and they make each step slower. For short answers and simple tool calls, none is usually faster and cheaper.

Run sends the value to the provider of each model call:

Provider none low, medium, high
Anthropic 4.6+ Thinking off. Sonnet 5.5 uses its lowest setting. Opus 5.5 always thinks, so Run sends effort low. Effort low, medium or high.
Anthropic, older Thinking off. Thinking budget of 1,024, 4,096 or 16,384 tokens, added to max_output_tokens.
OpenAI and Azure Effort none. A model without none gets its lowest effort (minimal or low). Effort low, medium or high.
Google Gemini 2.5 Thinking budget 0. Thinking budget of 1,024, 8,192 or 24,576 tokens.
Google Gemini 3 Thinking level minimal. Thinking level low, medium or high.
Bedrock Reasoning off. Maximum reasoning effort low, medium or high.
llm.gateway reasoning_effort: none. reasoning_effort with the same value.

When a model refuses the value, Run sends the step again without it. The run does not fail. The model span of the run trace shows the value sent in reasoning, or {value}:refused after a refusal. usage.reasoning_tokens counts the reasoning tokens of the run.

Who pays the tokens

Each model call has one inference source. The run usage.inference shows it.

Source When Billing
gateway The agent sets llm.gateway. This always wins. Run units only.
byok The run can use the provider key secret (vault or override). Run units only.
cloudraker Neither of the above. Model cost from the AI wallet, plus run minutes.

Your provider keys

Store the key as an org secret with the name below. The run uses it from the next call. You change nothing in agent.yml.

Provider Key secret Config secret Host
anthropic ANTHROPIC_API_KEY — api.anthropic.com
openai OPENAI_API_KEY — api.openai.com
google GOOGLE_API_KEY — generativelanguage.googleapis.com
bedrock AWS_BEDROCK_API_KEY AWS_BEDROCK_REGION bedrock-runtime.{region}.amazonaws.com
azure AZURE_OPENAI_API_KEY AZURE_OPENAI_RESOURCE {resource}.openai.azure.com
curl -X PUT "https://$ORG.cloudraker.run/_secrets/ANTHROPIC_API_KEY" \
  -H "Authorization: Bearer $RUN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "value": "sk-ant-…" }'

Bedrock uses a Bedrock API key (bearer token), not AWS SigV4 signing. Store the region and the Azure resource name as secrets too. They set the host, not a header.

A key per end user

Declare the key as overridable, then send it per run. Each end user then pays with their own key.

secrets:
  OPENAI_API_KEY: { overridable: true }
{ "input": "…", "secrets": { "OPENAI_API_KEY": "sk-end-user-…" } }

An override lives for one turn only. Read per-run overrides.

Your own gateway

Any OpenAI-compatible endpoint works: Cloudflare AI Gateway, LiteLLM, OpenRouter, vLLM.

llm:
  gateway: gateway.example.com # a host, not a URL and not a secret
  base_path: /v1 # default /v1
  headers: { Authorization: 'Bearer ${secret:LLM_GATEWAY_TOKEN}' }
secrets:
  LLM_GATEWAY_TOKEN: {}

The base URL is https://{gateway}{base_path}. The gateway gets the full provider/model id as the model name. The host joins the network allow list. A run request can override LLM_GATEWAY_TOKEN when it is overridable, but it can never change the host.

Key safety

Model traffic is egress too. The provider key goes into a header at the egress layer, by the same header-template rule as every other secret. The run never holds a key beyond one request. Read Secrets and network.

Type to search…

↑↓ navigate↵ selectEsc close