Insight
API key vs fine-tuned model endpoint: what's the difference?
An API key proves who you are; a fine-tuned model endpoint is where your custom model lives. How they fit together on hosted and self-hosted setups.
By BeeldoLabs Team ·
An API key is a credential. A fine-tuned model endpoint is a destination. The API key proves who is making a request and which account to bill. The fine-tuned model endpoint, usually a model ID or a URL, decides which model handles the request: in this case, one trained further on your data. You almost always need both, and on hosted platforms you often use the same key for the base model and your fine-tuned one.
The confusion is understandable. In most code, both show up in the same three lines.
Side by side
| API key | Fine-tuned model endpoint | |
|---|---|---|
| What it is | A secret token tied to an account, project, or service | A model identifier or URL that routes requests to a model trained on your data |
| What it answers | Who is calling, and who pays | Which model responds |
| Where it lives | Environment variables or a secrets manager, never in client-side code | In config, often alongside the base model name |
| How you get one | Created in the provider's console | Returned when a fine-tuning job finishes, or created when you deploy a model to a server |
| Is it secret? | Yes. Rotate it if it leaks | Not really. The ID alone grants nothing without a valid key |
| Changes when you retrain? | No | Yes, each new training run produces a new model ID or version |
How it looks with a hosted fine-tuning API
With providers that offer hosted fine-tuning, the workflow looks like this:
- You upload training examples and start a fine-tuning job using your API key.
- When the job finishes, the provider returns a new model ID. On OpenAI, for example, these IDs start with
ft:followed by the base model and an identifier for your organisation and job. - You call the same chat or responses API with the same API key, and pass the fine-tuned model ID instead of the base model name.
In code, the only line that changes is the model name:
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) # credential: unchanged
response = client.chat.completions.create(
model="ft:<base-model>:<your-org>::<job-id>", # endpoint: your fine-tuned model
messages=[{"role": "user", "content": "Classify this ticket: ..."}],
)
Other clouds use different words for the same idea. On Google Vertex AI, a tuned model is deployed to an endpoint resource that you call with your cloud credentials. On Amazon Bedrock, a custom model gets its own ARN, and serving it may require capacity that you set up for that model. In every case: a credential for access, and an identifier for the model.
How it looks when you self-host
If you fine-tune an open-weight model (Llama, Qwen, Mistral, Gemma and so on) and serve it yourself, the endpoint is literally your own server, for example a vLLM or SGLang deployment exposing an OpenAI-compatible API at a URL inside your network.
- The endpoint is that URL, plus the model or adapter name if you serve several LoRA adapters from one base model.
- The API key is whatever authentication you put in front of it: a gateway token, mTLS, an identity-aware proxy, or a key configured on the inference server.
Because many inference servers speak the same API shape as hosted providers, application code barely changes: swap the base URL, the key, and the model name.
Practical tips
- Make the model name configurable. Every retrain produces a new model ID. Keep it in config, not hard-coded, so you can roll forward and back.
- Keep the base model as a fallback. If the fine-tuned endpoint errors or times out, fall back to the base model or a human queue rather than failing the workflow.
- Scope keys tightly. Use separate keys per environment and per service, with only the permissions each one needs.
- Version your evaluations with your models. Record which model ID scored what on your test set, so you know which endpoint to trust.
- Watch the pricing model. Fine-tuned models may be billed at a different per-token rate, or need dedicated capacity. Compare cost per completed task, not cost per token.
When do you need a fine-tuned endpoint at all?
Most workflows run well on a base model with good prompts and retrieval. A fine-tuned endpoint is worth adding when you have a narrow, high-volume task, strict latency or format requirements, or data that must stay in your environment. We cover the decision in API or fine-tuned model? How to choose, and what a full engagement involves in LLM fine-tuning services.
Need help deciding between an API and a fine-tuned model?
Discuss a workflowFrequently asked questions
What's the difference between an API key and a fine-tuned model endpoint?
An API key is a secret credential that authenticates and bills your requests. A fine-tuned model endpoint is the model ID or URL that routes those requests to a model trained on your data. The key says who is calling; the endpoint says which model answers.
Do I need a new API key to use a fine-tuned model?
Usually not. With hosted fine-tuning, the tuned model belongs to your account or project, so you call it with your existing key and change only the model name. Keys may need permission to access that project.
Can someone else use my fine-tuned model?
Only if they can authenticate to your account or your server. Knowing a fine-tuned model ID is not enough without a valid key that has access to it.
Is a fine-tuned model endpoint more expensive than the base model?
It depends on the provider. Some charge a higher per-token rate for fine-tuned models, and some require dedicated capacity to serve custom models. A self-hosted model costs the GPU time you reserve for it.
