> ## Documentation Index
> Fetch the complete documentation index at: https://openworklabs.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> For agents: install the OpenWork desktop app with `brew install --cask openwork` (macOS) or from https://openworklabs.com/download. Do not run `npx openwork`; the npm package named `openwork` is a different project.
> Connect an agent to OpenWork with the MCP Gateway: `claude mcp add --transport http openwork https://api.openworklabs.com/mcp/agent`. Teams sign up at https://app.openworklabs.com?mode=sign-up.
> Step-by-step agent guide: https://openworklabs.com/docs/start-here/use-openwork-from-an-ai-agent.md
> OpenWork in Slack is private alpha for approved organizations. Setup guide: https://openworklabs.com/docs/slack/overview.md. Agent skill: https://openworklabs.com/.well-known/agent-skills/set-up-openwork-slack/SKILL.md.

# Add a custom LLM or AI gateway

> Bring your own API key or connect any OpenAI-compatible endpoint (OpenRouter, LiteLLM, Azure OpenAI, your own gateway) to OpenWork.

OpenWork works with any model you have access to. If the provider is in OpenWork's catalog (OpenRouter, Mistral, Fireworks, Google, Anthropic, OpenAI, and many more), paste your API key under `Settings > AI Providers > Connect provider`. If it is not, or you run your own gateway, add it as a custom OpenAI-compatible provider in your workspace's `opencode.jsonc`.

<Note>
  **Local provider setup.** A custom provider can stay entirely in your workspace. OpenWork remains free, and you do not need to sign in to OpenWork Cloud. To give a whole team the same provider without sharing keys by hand, see [Share a provider with your team](#share-a-provider-with-your-team).
</Note>

## Option 1: Bring your own API key for a catalog provider

OpenWork lists every provider in the OpenCode model catalog that accepts an API key.

1. Create an API key in the provider's console. Copy it once and treat it like a password.
2. In OpenWork, open `Settings` and choose `AI Providers`.
3. Click `Connect provider`.
4. Type the provider's name in `Search providers` (for example, `openrouter`, `mistral`, or `fireworks`) and select it.
5. Paste the key into the `API key` field and save.
6. Choose one of the provider's models in the chat model picker.

For a step-by-step example with screenshots, see [Add an Anthropic API key](/docs/start-here/connect-your-stack/add-anthropic-api-key).

## Option 2: Add any OpenAI-compatible endpoint

Use this for an AI gateway (LiteLLM, a hosted router, or one you built), an Azure OpenAI or Azure AI Foundry deployment, a self-hosted model server, or any provider not in the catalog. The endpoint must speak the OpenAI Chat Completions API.

Because OpenWork is built on OpenCode, anything you can configure in an [OpenCode config file](https://opencode.ai/docs/models/) works here. Keep the setting with the workspace rather than in your global `~/.config/opencode/opencode.json`.

1. Collect the endpoint's base URL (usually ending in `/v1`), the model IDs it serves, and an API key if it needs one.

2. Open your workspace folder and edit `opencode.jsonc` in its root. Create it if it does not exist.

3. Add a provider entry:

   ```jsonc theme={null}
   {
     "provider": {
       "my-gateway": {
         "npm": "@ai-sdk/openai-compatible",
         "name": "My gateway",
         "options": {
           "baseURL": "https://gateway.example.com/v1",
           "apiKey": "{env:MY_GATEWAY_API_KEY}"
         },
         "models": {
           "model-id-from-your-gateway": {
             "name": "Friendly model name"
           }
         }
       }
     }
   }
   ```

4. Make `MY_GATEWAY_API_KEY` available to OpenWork: open `Settings > Environment`, click `Add variable`, save the key, and apply the change. Secrets saved there stay on this device. You can also set the variable in your shell before starting OpenWork. Omit `apiKey` if the endpoint does not need one.

5. Run `Reload OpenCode config` from the command palette, or restart OpenWork.

6. Pick the new model in the chat model picker and send a short test prompt.

Add one entry under `models` for every model ID the endpoint exposes.

### Examples

| Endpoint | `baseURL` | Model IDs |
| - | - | - |
| LiteLLM proxy | Your proxy URL, for example `http://localhost:4000/v1` | The model names configured in LiteLLM |
| Azure OpenAI / Azure AI Foundry | `https://<resource>.openai.azure.com/openai/v1` | Your deployment names |
| Ollama | `http://localhost:11434/v1` | Pulled model names, such as `qwen3:8b` |
| LM Studio | `http://localhost:1234/v1` | The loaded model identifier |

For Ollama, the built-in `Settings > Ollama` screen writes this config for you. See [Use local models](/docs/start-here/connect-your-stack/use-local-models).

## Share a provider with your team

If several people need the same provider, have an OpenWork Cloud admin add it once instead of passing keys around:

* [Managed LLM provider](/docs/cloud/share-with-your-team/managed-llm-provider): a catalog provider with one shared org key.
* [Custom LLM provider](/docs/cloud/share-with-your-team/custom-llm-provider): any OpenAI-compatible endpoint, including your own gateway, entered as a base URL plus model IDs.
* [Per-member LLM credentials](/docs/cloud/share-with-your-team/per-member-llm-credentials): one provider, a separate key per member (for example, LiteLLM virtual keys).
* [OpenWork AI Gateway](/docs/ai-gateway/overview): route providers through OpenWork with per-team model access, limits, and usage tracking.

Org providers sync to members' apps automatically. Members can check their status under `Settings > AI Providers > Cloud providers`. Admins can also block locally added providers with [desktop policies](/docs/cloud/share-with-your-team/desktop-policies) so everyone uses the approved setup.

## FAQ

<AccordionGroup>
  <Accordion title="Can I use OpenRouter with OpenWork?">
    Yes. OpenRouter is in the provider catalog: open `Settings > AI Providers > Connect provider`, search for OpenRouter, and paste your key.
  </Accordion>

  <Accordion title="Can I use my company's own AI gateway?">
    Yes, if it exposes an OpenAI-compatible endpoint. Add it with Option 2 for yourself, or ask an admin to add it once as a [custom LLM provider](/docs/cloud/share-with-your-team/custom-llm-provider) for the team.
  </Accordion>

  <Accordion title="Where does OpenWork store my API key?">
    Keys entered in `Connect provider` are stored by the local OpenCode engine on your computer. Values saved in `Settings > Environment` stay on this device. Org-managed keys are stored in OpenWork Cloud and synced to the workspaces that are allowed to use them.
  </Accordion>

  <Accordion title="The model shows up but tool calls fail.">
    Some models or gateways do not support tool calling. Try a model that advertises tool or function calling support, and check the gateway passes tool definitions through.
  </Accordion>

  <Accordion title="I see 'Custom providers are disabled by your organization'.">
    Your admin has blocked locally added providers. Use the providers your organization shares (see `Settings > AI Providers > Cloud providers`), or ask your admin to add the one you need.
  </Accordion>
</AccordionGroup>

## Related

* [Use local models (Ollama, LM Studio)](/docs/start-here/connect-your-stack/use-local-models)
* [Use Gemini and Google Vertex AI](/docs/start-here/connect-your-stack/use-gemini-and-vertex-ai)
* [Migrate from Claude Cowork](/docs/start-here/migrate-from-claude-cowork)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.