ChatPorter integrates with the v0 Platform API to create actual chat sessions from your markdown files.
Based on the v0 Platform API documentation, ChatPorter uses the chats.init() method to create chats from files.
Get your API key from: https://v0.app/settings/api
Set it as an environment variable:
export V0_API_KEY=your_api_key_hereOr use the --api-key option:
chatporter upload docs/*.md --api --api-key your_keyChatPorter uses the following v0 Platform API endpoints:
- Create Chat:
POST /v1/chats/init- Creates a new chat session with uploaded files
- Returns chat ID and URL
ChatPorter tries to use the v0-sdk package first (if installed), then falls back to direct HTTP API calls. This ensures compatibility even if the SDK package structure changes.
Files are uploaded in the format expected by v0:
{
type: 'files',
files: [
{
name: 'docs/filename.md',
content: 'file content...',
locked: false // Whether AI can modify this file
}
],
name: 'Chat Name',
lockAllFiles: false,
projectId: 'optional-project-id'
}Successful API calls return:
{
id: 'chat-id',
// ... other chat properties
}The chat URL is: https://v0.dev/chat/{chat.id}
ChatPorter handles common API errors:
- 401 Unauthorized: Invalid or missing API key
- 400 Bad Request: Invalid file format or payload
- Network Errors: Connection issues
All errors are displayed with helpful messages and suggestions.
Refer to the v0 Platform API rate limits documentation for current limits.
# Set API key
export V0_API_KEY=your_key
# Create chat
chatporter upload docs/*.md --apichatporter upload docs/*.md \
--api \
--name "Project Documentation" \
--lock-files \
--project-id your-project-idchatporter
# Select "v0.dev (API)" option
# Enter API key if not setIssue: V0_API_KEY not found
- Solution: Set the environment variable or use
--api-keyoption
Issue: API Error: 401
- Solution: Check that your API key is valid and not expired
Issue: v0-sdk not found
- Solution: This is fine - ChatPorter will use direct HTTP calls
Issue: Network error
- Solution: Check your internet connection and firewall settings