truegleai's picture
Deploy FastAPI server with CodeLlama 7B
b1434df verified
---
title: CodeLlama API Server
emoji: ๐Ÿš€
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
license: apache-2.0
startup_duration_timeout: 1h
---
# CodeLlama API Server
OpenAI-compatible API server running CodeLlama 7B Instruct for code generation.
## Features
- OpenAI-compatible `/v1/chat/completions` endpoint
- OpenAI-compatible `/v1/completions` endpoint
- Simple `/generate` endpoint for quick testing
- No rate limiting - designed for unlimited usage
- Up to 4096 token context and responses
- CORS enabled for MCP server integration
## API Endpoints
### Chat Completions (Recommended)
```bash
curl -X POST https://truegleai-deepseek-coder-6b-api.hf.space/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "codellama-7b-instruct",
"messages": [
{"role": "user", "content": "Write a Python function to reverse a string"}
],
"max_tokens": 512
}'
```
### Simple Generation
```bash
curl -X POST https://truegleai-deepseek-coder-6b-api.hf.space/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Write a Python function to reverse a string",
"max_tokens": 512
}'
```
## MCP Server Integration
Use this Space as a backend for your MCP server by pointing it to:
```
https://truegleai-deepseek-coder-6b-api.hf.space
```
The API is OpenAI-compatible, so you can use it anywhere you'd use OpenAI's API.