Model providers

Which model providers ocra can use, what each needs, and how to use your own endpoint.

On the default runtime, every provider in OpenCode's catalog works except the few that need code from npm. Name a model as provider/model in the model chains (Configuration); the runtime receives only the credentials of the providers they name.

Providers in OpenCode's catalog

ProviderExample modelWhat to setTested live
Gemini APIgoogle/gemini-3.5-flashGEMINI_API_KEY (or GOOGLE_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY)Yes
Vertex AIgoogle-vertex/gemini-3.5-flashGOOGLE_VERTEX_PROJECT, GOOGLE_VERTEX_LOCATION=global, and application default credentials or GOOGLE_APPLICATION_CREDENTIALSYes, also keyless from GitHub Actions through workload identity federation
Anthropicanthropic/<model>ANTHROPIC_API_KEYNo
OpenAIopenai/<model>OPENAI_API_KEYNo
Amazon Bedrockamazon-bedrock/<model>AWS_REGION and AWS credentials: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (with AWS_SESSION_TOKEN), AWS_PROFILE, or AWS_BEARER_TOKEN_BEDROCKNo
Azure OpenAIazure/<deployment>AZURE_API_KEY, AZURE_RESOURCE_NAMENo
DeepSeek, OpenRouter, Groq, Mistral, xAI and the rest of the catalogdeepseek/<model>The provider's key, such as DEEPSEEK_API_KEY; for an id ocra does not know, every variable starting with it, such as GROQ_No

"No": ocra passes the variables and OpenCode does the rest, but no review has run through that provider yet; if one fails, open an issue. Model ids come from models.dev, OpenCode's catalog.

Providers that need code from npm

For a few providers OpenCode would download its client code from npm on first use, which ocra does not allow during a review. In the catalog of 2026-09-29 these are aihubmix, cloudflare-ai-gateway, merge-gateway, qvac, salad-cloud, sap-ai-core and watsonx; their models fail at once with "Failed to initialize provider". If such a service has an OpenAI-compatible endpoint, declare it as your own endpoint.

Your own endpoint

A self-hosted server (vLLM, Ollama, LM Studio) or a company gateway that speaks the OpenAI API is declared in .ocra/config.json:

{
  "models": {
    "standard": "gateway/qwen3-coder",
    "light": "gateway/qwen3-small",
    "top": "gateway/qwen3-max"
  },
  "providers": {
    "gateway": {
      "type": "openai-compatible",
      "baseUrl": "https://llm.example.com/v1",
      "apiKeyEnv": "GATEWAY_API_KEY",
      "models": {
        "qwen3-coder": { "input": 0.5, "output": 2, "cachedInput": 0.1 },
        "qwen3-small": { "input": 0.1, "output": 0.4 },
        "qwen3-max": { "input": 2, "output": 8 }
      }
    }
  }
}
  • The id (gateway) is yours: lowercase letters, digits and hyphens. Avoid ids in OpenCode's catalog: a declaration replaces the known provider for the run.
  • baseUrl must be https, or plain http on this machine: localhost, 127.0.0.1 or ::1. For Ollama, for example, http://127.0.0.1:11434/v1. It may not contain { or }, which OpenCode would replace with a variable or a file's content.
  • apiKeyEnv names the variable holding the key; the key never goes in the file, and only this variable reaches the runtime. Platform tokens and cloud credentials (GITHUB_, GITLAB_, CI_, AWS_, AZURE_ and similar) are refused. Omit it for a server without keys.
  • effort (optional) says how the endpoint takes a reasoning effort, on either runtime: openai (default; OpenAI, Gemini's OpenAI-compatible endpoint and OpenRouter accept it) sends reasoning_effort, openrouter sends reasoning: { effort }.
  • Every model has a price in US dollars per million tokens: input, output, optionally cachedInput, used for the reported cost and --max-cost-usd. A price of 0 (your own hardware) makes the run warn that the spend limit does not count the model.
  • A shared configuration (extends) may declare providers only when pinned with #sha256=; otherwise whoever serves it could redirect your code. ocra ignores an unpinned one that declares providers, with a warning giving the pin to add once you have checked it. The repository's declaration of the same id wins. In pull and merge requests, providers come from the base commit.

Tested in CI against a fake OpenAI-compatible server with the real OpenCode binary (the key goes where it should, the price is counted, nothing else is reached), and live on OpenRouter (a free model, 2026-10-02).

Free models through OpenRouter

A free model on OpenRouter is declared like any endpoint, at a price of 0 under OpenRouter's model id, and named <endpoint id>/<model id>. ocra init writes this for an OpenRouter key, with openrouter/free, the router that sends each request to one of its free models:

{
  "models": {
    "top": "router/openrouter/free",
    "standard": "router/openrouter/free",
    "light": "router/openrouter/free"
  },
  "providers": {
    "router": {
      "type": "openai-compatible",
      "baseUrl": "https://openrouter.ai/api/v1",
      "apiKeyEnv": "OPENROUTER_API_KEY",
      "models": { "openrouter/free": { "input": 0, "output": 0 } }
    }
  }
}
  • The run reports a cost of $0 and warns that --max-cost-usd does not count the model; tokens are still reported.
  • With --no-repo-config, as in the evaluation harness, keep the file outside the reviewed repository and pass it with --config.
  • The evaluation's judge can use the same endpoint: JUDGE_API_KEY, JUDGE_BASE_URL=https://openrouter.ai/api/v1 and JUDGE_MODEL=openrouter/free.
  • The router picks a different model per request, so review quality varies. To compare runs, name one free model (its id ends in :free, such as nvidia/nemotron-3-ultra-550b-a55b:free, which this repository's CI pins); OpenRouter withdraws free models without notice, and a withdrawn one answers HTTP 404, failing the review.
  • Without credits, OpenRouter allows about 50 free requests a day across its :free models, and 1000 once the account has bought at least $10 of credits; a review takes 30 to 70 requests per task, so a large one may stop part way. Some zero-price models without :free need credits and answer HTTP 402 otherwise.
  • Free models, limits and prices change without notice, and a free model's provider may keep what it is sent. Use them to try ocra, not on code you must keep private.

The declared endpoint works without OpenCode's pricing catalog; the catalog form, openrouter/<model>, needs the catalog reachable and the model in it, and fails at once otherwise.

Choosing the runtime

Two runtimes can run the reviewers; runtime in the configuration picks one:

RuntimeReachesUse it when
opencode (default)Every provider in OpenCode's catalog and your declared endpoints, plus the pricing catalog models.opencode.aiYour models are Gemini, Vertex AI, Anthropic, Bedrock or another catalog provider
directOnly the endpoints declared under providers; nothing else on the networkEvery model in your chains is on a declared endpoint, and you want nothing but that endpoint reached

Both run the same review: tools, step cap, failback and prices. direct refuses, before any request, a chain naming a provider you did not declare, and honors HTTP_PROXY, HTTPS_PROXY and NO_PROXY. The quality numbers were measured on opencode; direct passes the same conformance tests but has not been evaluated on the golden set yet.

To see what direct sent a model and got back, set OCRA_RECORD_DIR to a directory: each request is written there as a JSON file with its answers, readable only by you. Keys become <key>, an ocra Cloud token renewed during the run included, and headers and the endpoint address are left out, but the files hold the code and prompts, so guard them like the code. A recording ocra cannot write is a warning on stderr; the review goes on and no request is sent again. A recording replays only the exact conversation it recorded. opencode ignores the variable.

The opencode runtime is an optional dependency, installed by default; with direct you can leave it out and save about 165 MB: see Without OpenCode and the Action's opencode: false input.

What else reaches the network

Besides the model providers, OpenCode fetches its pricing catalog from models.opencode.ai at start. Its attempts to install its plugin package, or a provider's code, from npm go to a local registry that refuses them at once. A review works with every address but a declared endpoint refused (tested): the catalog fetch fails, OpenCode uses its bundled catalog, and a model missing from it has no price, so the run warns its calls are not counted.

Edit on GitHub

On this page