{"openapi":"3.1.0","info":{"title":"sellapi","version":"1.0.0","description":"OpenAI-compatible API for chat, embeddings, and image generation. Pay with credits, access 100+ models through a single endpoint.","contact":{"name":"sellapi support","url":"https://www.getmorecredits.com\n/docs"}},"servers":[{"url":"https://www.getmorecredits.com\n/v1","description":"Production"},{"url":"http://localhost:3000/v1","description":"Local dev"}],"security":[{"bearerAuth":[]}],"paths":{"/chat/completions":{"post":{"summary":"Create a chat completion","description":"OpenAI-compatible chat completions. Supports streaming, system messages, multimodal input, and function calling.","tags":["Chat"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"},"examples":{"basic":{"summary":"Basic chat","value":{"model":"anthropic/claude-sonnet-4.6","messages":[{"role":"user","content":"Hello!"}]}},"streaming":{"summary":"Streaming","value":{"model":"openai/gpt-5.4","messages":[{"role":"user","content":"Write a haiku"}],"stream":true}},"tools":{"summary":"Function calling","value":{"model":"anthropic/claude-sonnet-4.6","messages":[{"role":"user","content":"Weather in Berlin?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get current weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]}}}}}},"responses":{"200":{"description":"Chat completion or SSE stream","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponse"}},"text/event-stream":{"schema":{"type":"string","description":"SSE stream of completion chunks"}}},"headers":{"x-sellapi-credits-charged":{"schema":{"type":"string"}},"x-sellapi-credits-balance":{"schema":{"type":"string"}},"x-ratelimit-limit":{"schema":{"type":"string"}},"x-ratelimit-remaining":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/UpstreamError"}}}},"/embeddings":{"post":{"summary":"Create embeddings","tags":["Embeddings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingRequest"},"example":{"model":"openai/text-embedding-3-small","input":["Hello world","Another text"]}}}},"responses":{"200":{"description":"Embedding vectors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/images/generations":{"post":{"summary":"Generate images","tags":["Images"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageRequest"},"example":{"model":"google/imagen-4.0-generate-001","prompt":"A sunset over the ocean","n":1}}}},"responses":{"200":{"description":"Generated images (base64)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/models":{"get":{"summary":"List available models","tags":["Models"],"responses":{"200":{"description":"Models with pricing and tier access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelList"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key from /dashboard/keys, prefixed with `sk-sellapi-`."}},"schemas":{"ChatCompletionRequest":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","example":"anthropic/claude-sonnet-4.6"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessage"}},"stream":{"type":"boolean","default":false},"max_tokens":{"type":"integer"},"temperature":{"type":"number","minimum":0,"maximum":2},"tools":{"type":"array","items":{"$ref":"#/components/schemas/Tool"}},"tool_choice":{"oneOf":[{"type":"string","enum":["auto","required","none"]},{"type":"object"}]}}},"ChatMessage":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object"}}]},"tool_call_id":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object"}}}},"Tool":{"type":"object","required":["type","function"],"properties":{"type":{"type":"string","enum":["function"]},"function":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"parameters":{"type":"object"}}}}},"ChatCompletionResponse":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["chat.completion"]},"created":{"type":"integer"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"$ref":"#/components/schemas/ChatMessage"},"finish_reason":{"type":"string"}}}},"usage":{"$ref":"#/components/schemas/Usage"}}},"EmbeddingRequest":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","example":"openai/text-embedding-3-small"},"input":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"encoding_format":{"type":"string","enum":["float","base64"]},"dimensions":{"type":"integer"}}},"EmbeddingResponse":{"type":"object","properties":{"object":{"type":"string","enum":["list"]},"data":{"type":"array","items":{"type":"object","properties":{"object":{"type":"string","enum":["embedding"]},"embedding":{"type":"array","items":{"type":"number"}},"index":{"type":"integer"}}}},"model":{"type":"string"},"usage":{"$ref":"#/components/schemas/Usage"}}},"ImageRequest":{"type":"object","required":["model","prompt"],"properties":{"model":{"type":"string","example":"google/imagen-4.0-generate-001"},"prompt":{"type":"string"},"n":{"type":"integer","minimum":1,"maximum":4,"default":1},"size":{"type":"string","example":"1024x1024"},"response_format":{"type":"string","enum":["b64_json","url"]}}},"ImageResponse":{"type":"object","properties":{"created":{"type":"integer"},"data":{"type":"array","items":{"type":"object","properties":{"b64_json":{"type":"string"},"revised_prompt":{"type":"string"}}}}}},"ModelList":{"type":"object","properties":{"object":{"type":"string","enum":["list"]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["model"]},"created":{"type":"integer"},"owned_by":{"type":"string"},"display_name":{"type":"string"},"category":{"type":"string","enum":["chat","reasoning","image","embedding"]},"free_tier_allowed":{"type":"boolean"},"pricing":{"type":"object","properties":{"input_per_1m_usd":{"type":"number"},"output_per_1m_usd":{"type":"number"},"per_image_usd":{"type":"number"}}}}}}}},"Usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"}}}}}},"responses":{"Unauthorized":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InsufficientCredits":{"description":"Not enough credits — top up at /dashboard/billing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"Tier or scope restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Unknown model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Too many requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"retry-after":{"schema":{"type":"string"}}}},"UpstreamError":{"description":"Upstream provider failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"tags":[{"name":"Chat","description":"Chat completions (streaming + function calling)"},{"name":"Embeddings","description":"Text embeddings"},{"name":"Images","description":"Image generation"},{"name":"Models","description":"Model catalog and pricing"}]}