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

# External LLM

> Use any OpenAI-compatible LLM API

Configure agents to use an external LLM instead of our default models.
Maintain full control over the language model while leveraging Beyond Presence's optimized avatar and agent management stack.

## Use Cases

External LLM configuration is ideal for:

* **Custom models**: Use fine-tuned or specialized language models
* **Data control**: Route LLM requests through your own infrastructure or preferred providers
* **Regulatory compliance**: Meet specific data residency requirements

## Requirements

Your external LLM API must implement a single endpoint following the OpenAI-compatible [Chat Completions API](https://platform.openai.com/docs/api-reference/chat/create) format.

At minimum, the endpoint must support:

* Standard chat completion requests with `messages` array
* Streaming responses with server-sent events

Additional features like function calling or vision are optional and only needed if your specific use case requires them.

<Warning>
  While not strictly required, we recommend supporting token authentication for secure access.
</Warning>

## Using Popular Providers

Many LLM providers offer OpenAI-compatible endpoints that work out of the box:

**xAI (Grok)**: [Get API key](https://docs.x.ai/docs/tutorial)

* Base URL: `https://api.x.ai/v1`
* Models: `grok-4`, `grok-3-beta`, `grok-code-fast-1`

**Google (Gemini)**: [Get API key](https://aistudio.google.com/app/apikey)

* Base URL: `https://generativelanguage.googleapis.com/v1beta/openai`
* Models: `gemini-2.0-flash`, `gemini-1.5-pro`, `gemini-1.5-flash`

<Note>
  Using these providers may incur additional costs based on their pricing models.
</Note>

## Configuration

You can configure external LLMs through our API.
Dashboard support is planned for a future release.

1. Register your LLM API with the [Create External API Configuration endpoint](/api-reference/external-apis/create-external-api-configuration)
2. Reference the configuration when creating an agent with the [Create Agent endpoint](/api-reference/agents/create-agent#openaicompatibleagentllm)

<Tip>
  While we require you to specify a token for the API, you can pass an empty string if your endpoint does not require authentication.
</Tip>

## Complete Example

See our [external LLM example](https://github.com/bey-dev/bey-examples/tree/main/custom-llm#readme) for full implementation including API registration, agent creation, and optional deployment of a compatible LLM API.

## Next Steps

<CardGroup cols={2}>
  <Card title="External LLM Example" icon="github" href="https://github.com/bey-dev/bey-examples/tree/main/custom-llm#readme">
    Complete implementation with deployment scripts
  </Card>

  <Card title="API: Create External API Configuration" icon="code" href="/api-reference/external-apis/create-external-api-configuration">
    Register external LLM APIs
  </Card>

  <Card title="API: Create Agent" icon="code" href="/api-reference/agents/create-agent#openaicompatibleagentllm">
    Configure external LLMs for managed agents
  </Card>

  <Card title="Back to Managed Agents" icon="arrow-left" href="/integrations/managed-agents">
    Return to managed agents overview
  </Card>
</CardGroup>
